0

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="automationteam@staysure.co.uk">
      <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

Nipuna Madusanka
  • 194
  • 2
  • 11
  • Can you please provide a bit more info so we can help you out? 1) are you using Xray on Jira server/datacenter or on Jira cloud? 2) can you share the exact jenkins configuration you're using, like a screenshot of it? 3) Can you please confirm that the user that you're using to upload the results can create Test and Test Execution issues on the target Jira project, by going there and creating manually those issues (the content is irrelevant)? – Sérgio Jul 03 '23 at 08:59
  • Thanks for helping me to sort this issue @Sérgio, I've updated the question. I'm using Jira cloud and I've been using the same user (serverInstance) for Cypress cucumber results upload and its creating Xray test execution results in Jira without any issue. – Nipuna Madusanka Jul 04 '23 at 03:07
  • On the targer project SPT on Jira, can you please create manually a Test issue through the UI? And a Test Execution issue? Does that work? – Sérgio Jul 04 '23 at 16:32
  • Can you try changing `failure="0"` to `failures="0"`? (on `testsuite`) That seems to be the format, possibly causing issues with Xray (see [here](https://www.ibm.com/docs/en/developer-for-zos/14.1?topic=formats-junit-xml-format)) – Atlow Jul 04 '23 at 18:15
  • @Sérgio I could be able to create issue for step during manual xray execution. – Nipuna Madusanka Jul 05 '23 at 07:01
  • @Atlow I just manually changed it and still Xray was rejecting the XML file. – Nipuna Madusanka Jul 05 '23 at 07:02
  • I guess it's something related to your Jira environment. I would recommend reaching out Xray support team (https://jira.getxray.app/servicedesk/customer/portal/2) directly, so they can see this with you in more detail. – Sérgio Jul 05 '23 at 10:59
  • Thanks @Sérgio, The issue was fixed after adding properties tag with Xray test ID manually into output junit xml. The execution is also perfectly displayed in Xray side, linked to its original test ID. So now I'm trying to add the same tag from Testim. – Nipuna Madusanka Jul 05 '23 at 15:00

1 Answers1

0

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="automationteam@staysure.co.uk">
      <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

Nipuna Madusanka
  • 194
  • 2
  • 11
  • First, glad it worked out. Anyway, it should work without that property you specified; that property is used if you want to report results for an existing Test issue. Otherwise, if we don't provide it, Xray will autoprovision Test issues for your, one for each element. If it can't do that, as in your original request, then there's some issue with the Jira instance/integration that only Xray support can help you out understand what might be happening exactly. – Sérgio Jul 06 '23 at 09:06