Importing Testim Junit xml to Xray failed with message Error creating issues in Jira

344 Views Asked by At

I'm trying to import JUnit XML generated through Testim with Jenkins and received following error.

Starting XRAY: Results Import Task...
##########################################################
####     Xray is importing the execution results      ####
##########################################################
File found: C:\ProgramData\Jenkins\.jenkins\workspace\TestimTestPro\testim-tests-report.xml
Starting to import results from testim-tests-report.xml
ERROR: Step ‘Xray: Results Import Task’ failed: Unable to confirm Result of the upload..... Upload Failed! Status:400 Response:{"error":"Error creating issues in Jira!"}

Following is the XML

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<testsuites>
  <testsuite name="selenium run" tests="1" failure="0" timestamp="2023-06-30T04:52:26.555Z" skipped="0" failure-evaluating="0">
    <testcase name="test1" classname="testim.io.test" time="123.758" ownedBy="Staysure Automation" ownerEmail="[email protected]">
      <system-out>https://app.testim.io/#/project/9GScCUXVSOmXaUeDNvKA/branch/master/test/0gEraRql06D0MQdm?result-id=mCda0xgIGFUtfn2f</system-out>
    </testcase>
  </testsuite>
</testsuites>

Jenkins Pipeline enter image description here

Xray results upload step

stage('Upload xray test results') {
        step([$class: 'XrayImportBuilder', endpointName: '/junit', importFilePath: 'testim-tests-report.xml', importInParallel: 'false', importToSameExecution: 'false', projectKey: 'SPT', serverInstance: '<<<<CLOUD>>>>', testExecKey: 'SPT-3082', testPlanKey: 'SPT-3081'])
    };

I'm using Xray in Jira cloud and results uploading is working fine with same xray serverInstance with credentials for cypress cucumber json.

Looking for a solution to upload the execution report with new Xray Jira ticket

2

There are 2 best solutions below

1
On BEST ANSWER

I could able to upload the results from JUnit XML to Xray after adding properties tag with test key as follows.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<testsuites>
  <testsuite name="selenium run" tests="1" failure="1" timestamp="2023-06-30T07:10:08.937Z" skipped="0" failure-evaluating="0">
    <testcase name="test1" classname="testim.io.test" time="253.413" ownedBy="Staysure Automation" ownerEmail="[email protected]">
      <system-out>https://app.testim.io/#/project/9GScCUXVSOmXaUeDNvKA/branch/master/test/0gEraRql06D0MQdm?result-id=P2folrIsYwSNXOYr</system-out>
      <failure message="Step Failed: Element not found More info at: https://app.testim.io/#/project/9GScCU/branch/master/test/0gEraRql?result-id=P2folrIsY"/>
        <properties>
          <!-- using a custom "test_key" property -->
          <property name="test_key" value="SPT-4323" />
        </properties>
    </testcase>
  </testsuite>
</testsuites>

Since the XML did not provide a link to the test case that was running, I assume that the Xray was rejecting it. I'm currently attempting to add this tag from Testim side to JUnit XML.

enter image description here

0
On

Apologies for the very late reply. I think Testim now support Xray out of the box. It should work flawlessly once you complete integration with required parameters such as: Jira username, Jira API token, XRay client ID, XRay client secret, URL.

Please refer to the screenshot and documentation below.