Import junit results to Xray

ziedktari February 8, 2024

Hello,
I want to import JUnit formatted results into Xray using the JUnit multipart API. Since my tests don't currently exist in Xray, I want Xray to automatically create tests with specified fields such as priority and owner etc...

My test suite comprises numerous testCase results, each potentially having different properties.

Is it feasible to include fields like priority and custom fields for each test case, enabling Xray to create test cases with these designated attributes?

I've attempted to use testInfo file when call endPoint /api/v2/import/execution/junit/multipart , but it seems that the same properties are applied to all newly created tests.

Thanks in advance.

here is is my junit file

 

<?xml version="1.0" encoding="UTF-8" ?>
<testsuite tests="1" failures="0" name="ut.com.xpandit.raven.service.impl.other" time="0.163" errors="0" skipped="0">
   
<testcase classname="ut.com.xpandit.raven.service.impl.other" name="test demo" time="0.114">
  <properties>
        <property name="requirement" value="TEST-1159" />
        <property name="tags" value="label1,label2" />
          <property name="test_description">
                    <![CDATA[Some custom description for the test issue.]]>
            </property>
        <property name="testrun_comment">
                    <![CDATA[Lorem ipsum dolor sit amet,
consectetur adipiscing elit,
sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.]]>
                </property>
         
          #example of property that i want to add when import results
          <property name="test_priority" value= "high"> </property>



  </properties>

 

</testcase>

 

</testsuite>

1 answer

0 votes
Ignacio Aredez GenAI Expert
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 8, 2024

To import JUnit results into Xray and automatically create test cases with specified fields like priority and custom fields, while your current approach using the testInfo file applies the same properties to all tests, here's a streamlined solution:

Splitting JUnit Reports: Consider splitting your JUnit report into multiple reports based on the properties you want to assign (e.g., priority). Each report can then be imported with its own testInfo file specifying the desired properties for that group of tests.

Custom Fields in JUnit: Your approach of including custom fields directly in the JUnit XML is a good initiative. However, the effectiveness of this depends on Xray's capability to map these custom fields during the import process.

Scripted Workaround: A more flexible solution involves writing a script that:

  • Parses the JUnit report.
  • Extracts properties for each test case.
  • Uses the Xray API to create or update test cases with these properties before or after importing the JUnit results.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events