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’send_test
has 2 argumentsdata
andresult
, see the api documentation for robot.result.model.TestCase, gives youstatus
andmessage
as well asbody
, where you’ll find the top level keywords of the test and their individual statuses.
Use theto_dict()
method to make it easier to find where things are in the test caseresult
Hopefully that helps,
Dave.
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.