Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,369,658
Community Members
 
Community Events
168
Community Groups

Issue with XRAY execution results import

Edited

We are trying to import execution result into a Test Execution issue type in Jira Server (Native) in the JUnit XML format following REST API instructions in https://docs.getxray.app/display/XRAY/Import+Execution+Results+-+REST#ImportExecutionResultsREST-JUnitXMLresults

 

We have triggered the below API call:

curl -H "Content-Type: multipart/form-data"  -H "Authorization: Bearer <input-token-here>" -F "file=@junit.xml" http://localhost:8080/rest/raven/1.0/import/execution/junit?testExecKey=XP-8

 

We get back response as below:

{"testExecIssue":{"id":"10027","key":"XP-8","self":"http://localhost:8080/rest/api/2/issue/10027"},"infoMessages":[]}

 

But after opening the XP-8 Test Execution issue, we do not find any test record created related to the XML import. [In Xray cloud we have successfully tested out the execution result import using its corresponding REST API.]

 

Below are the contents from the junit.xml file:

<testsuite xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://maven.apache.org/surefire/maven-surefire-plugin/xsd/surefire-test-report-3.0.xsd" name="DefaultResultName" time="37.321" tests="2" skipped="0" errors="0" failures="0">
<testsuite name="Validate Service" time="6.143" tests="2" skipped="0" errors="0" failures="0">
<testcase name="Simple test for addition" time="2.083"/>
<testcase name="Simple test for subtraction" time="0.221"/>
</testsuite>
</testsuite>

 

If you could let us know if we are missing any step or in which location on the UI should we check for the result imported.

1 answer

0 votes
Stefan Salzl Community Leader Sep 01, 2022

Hi @Anuraag K B ,

As I could see in the documentation the "multipart" import expects additional JSON files. Honestly I´m not familiar with multipart import so far but did several imports of JUnit-xml.

As far as your description looks like you are trying to import result-xml. Could you try to use the xml-endpoint:

https://docs.getxray.app/display/XRAY/Import+Execution+Results+-+REST#ImportExecutionResultsREST-JUnitXMLresults

 

Best
Stefan

Thank you @Stefan Salzl for your response. I do not face any issue when importing JUnit XML to Xray cloud.. but there seems to be an issue with native Jira wherein the report isn't getting uploaded and I do not get any error message as well. Is there any place where I can report the issue.. (also am using localhost.. not sure if that would be issue)

Stefan Salzl Community Leader Sep 06, 2022

ah ok. I see. As the documentation says the API call needs your server:

Example Request

curl -H "Content-Type: multipart/form-data" -u admin:admin -F "file=@report.xml" -F "info=@testExec.json" -F "testInfo=@test.json" http://yourserver/rest/raven/1.0/import/execution/junit/multipart

 

Please give it a shot and let me know if this helps.

Best
Stefan

Hi @Stefan Salzl 

Seems like the Import Execution Results feature of XRay isn't working from the UI as well in the Jira on-premise server.

Am using the version Jira v9.2.0

 

As in below screenshot am trying to import the Execution Result via the Import Execution Results option from the Test Execution issue type but the tests do not get added post the junit xml file import.

import.PNG

Stefan Salzl Community Leader Sep 23, 2022

Hi @Anuraag K B 

did you also try to import via the „More“ button in the issue as describe in the documentation?

0BB8C1AF-A2E5-4431-A0C3-2EE7E9530CF8.png

https://docs.getxray.app/plugins/servlet/mobile?contentId=62270947#TestExecution-ImportExecutionTestResults

Do you get any error message after import?

Furthermore:
Which tool do you use for test automation? Where are the results generated?

Is it possible to see the xml?

 

Unfortantely I don‘t have any xray environment at the moment to verify/try out :(

Best
Stefan

Hi @Stefan Salzl 

Yeah I have tried uploading the file via the Import Execution Reults from "More" button as well but the result remains the same - response code is 200.

I will attach the XML file here. The same file gets uploaded successfully in the cloud Jira/Xray.

 

XML content:

https://codeshare.io/6pKAgO

 

Thanks,

Anuraag.

Stefan Salzl Community Leader Sep 26, 2022

Hi @Anuraag K B 

it seems your call is missing the method (POST). This is a call I used  succeessfully in the past:

curl -H "Content-Type: text/xml" -X POST \
-H "Authorization: Bearer ${{ secrets.XRAY_TOKEN }}" \
--data @"./cypress/test-results.xml" https://xray.cloud.getxray.app/api/v2/import/execution/junit?testExecKey=${key}

 

Best
Stefan 

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events