Send Output.xml to Xray API - incomplete file

When finalizing a test suite in the robot framework, I created a keyword through Suite Teardown to send to Xray (Jira), via API, the output.xml file with the Suite’s TestResult.
However, the Output.xml file is not yet complete (some TAGs are missing) and therefore I cannot send the file.
Does anyone have any idea how to perform this action via a .robot file?

listener interface has close event that is called with everything should be finished.

1 Like

Thanks my friend !
And I can call this event by command to be able to use the file before the suite ends ?

When you say “suite ends”, there is no quarantee that test execution has ended. There can still be multiple suites to be executed and thus, output.xml will be still invalid xml when “suite ends” and could be also be locked. This the approach of making a keyword that uploads output.xml in suite teardown will not work.

In order to get the stuff to xray, you either implement a listener that monitors “close” event and does the uploading to xray then … This would typically require python code.

You probably have better changes getting something working by just uploading the output.xml after robot execution has completely stopped. By adding (and probably writing it) your own listener, you can avoid that step. Do read up here: Robot Framework User Guide

And just for the sake of it:


To keep it simple, I would recommend just generating the output.xml report, as usual, and then upload it to Xray. Uploading can be done by an out-of-band process, like the CI tool (e.g. Jenkins), a simple “curl” request.
Eventually you could use a RF listener to do that (e.g. POST request to Xay) at the end… but I usually see people leaving that to the CI tool or even an external script that does that.