# Send Output.xml to Xray API - incomplete file

**URL:** <https://forum.robotframework.org/t/send-output-xml-to-xray-api-incomplete-file/1252>\
**Category:** Robot Framework\
**Created:** [26 January 2021 17:30 UTC](https://forum.robotframework.org/t/send-output-xml-to-xray-api-incomplete-file/1252 "2021-01-26T17:30:02Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Petronio](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/petronio/32/594_2.png) [@Petronio](https://forum.robotframework.org/u/Petronio)\
**Post date:** [26 January 2021 17:30 UTC](https://forum.robotframework.org/t/send-output-xml-to-xray-api-incomplete-file/1252/1 "2021-01-26T17:30:02Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![rasjani](https://avatars.discourse-cdn.com/v4/letter/r/858c86/32.png) [@rasjani](https://forum.robotframework.org/u/rasjani)\
**Post date:** [26 January 2021 18:04 UTC](https://forum.robotframework.org/t/send-output-xml-to-xray-api-incomplete-file/1252/2 "2021-01-26T18:04:02Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Petronio](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/petronio/32/594_2.png) [@Petronio](https://forum.robotframework.org/u/Petronio)\
**Post date:** [26 January 2021 18:13 UTC](https://forum.robotframework.org/t/send-output-xml-to-xray-api-incomplete-file/1252/3 "2021-01-26T18:13:00Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![rasjani](https://avatars.discourse-cdn.com/v4/letter/r/858c86/32.png) [@rasjani](https://forum.robotframework.org/u/rasjani)\
**Post date:** [27 January 2021 01:23 UTC](https://forum.robotframework.org/t/send-output-xml-to-xray-api-incomplete-file/1252/4 "2021-01-27T01:23:45Z")

</div>

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](https://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#listener-interface)

And just for the sake of it:

> **[How to Integrate Robot Framework with Xray - Xray Blog](https://www.getxray.app/blog/how-to-integrate-robot-framework-with-xray/)**
>
> Learn how to write automated Robot Framework test cases and track your results with Jira and Xray. Scale your test automation with Robot Framework.

---

<div class="post-metadata">

**Author:** ![bitcoder](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/bitcoder/32/737_2.png) [@bitcoder](https://forum.robotframework.org/u/bitcoder)\
**Post date:** [12 April 2021 11:30 UTC](https://forum.robotframework.org/t/send-output-xml-to-xray-api-incomplete-file/1252/5 "2021-04-12T11:30:52Z")

</div>

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.
