Output.xml doesn't get updated after every test case run during the test suite execution

I am trying to execute a test suite using a test runner. I am also used RobotTestListener. I am trying to get the output.xml file after each test case execution while running a test suite using a test runner. How can we have the output.xml updated after every test execution

Hi Akash,

The output.xml doesn’t get written until after the test suite has ended, so you can’t really do what your asking.

You could however:

  • run each test individually the the -t option on the command line, let the test finish and then using an external process collect the output.xml for that test before running the next test
  • use the robot framework api in your listener to get the detail that would be in the output.xml.
    e.g Listener version 3’s end_test has 2 arguments data and result, see the api documentation for robot.result.model.TestCase, gives you status and message as well as body, where you’ll find the top level keywords of the test and their individual statuses.
    Use the to_dict() method to make it easier to find where things are in the test case result

Hopefully that helps,

Dave.

2 Likes

The output.xml is actually written constantly when suites, tests and keywords are run, but due to buffering by operating systems the updates are not always immediately written to disk. We could easily “fix” that by flushing contents which forces the OS to write it to disk, but then execution would be IO bound and that would slow down execution considerably. You ought to be able to configure your OSes buffering settings, but also then you have a risk that execution slows down.

Typically when your are interested in getting information about the execution dynamically it’s best to implement a listener.

1 Like