Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
badges earned

Your Points Tracker
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Importing test results creates duplicate test Edited

I am sorry if this is already answered but I could not find this question in the community.

Here is what we are tying to do:

1. Create a new test via app with test type as Automated[Generic] but entering Summary & Test Definition. We are entering the test definition as test script path('.' separated)+summary. Let's assume the test key for this test is MYPROJ-999.

2. We then create a Test Plan and include this test in the test plan.

3. We run the automated test and generate Junit xml report.xml

4. We post the result using REST API with POST method.

curl -H "Content-Type: multipart/form-data" -u user:pwd -F "file=@pcx-qm-report-stg-exp.xml"^&testPlanKey=MYPROJ-702400178

Expected Result:

The result for MYPROJ-999 should be updated with PASS/FAILED under the Test Plan. No new test should be created.

Actual Result:

The API is creating a new test under the Test Plan. The existing test MYPROJ-999 is not updated instead a new test created.

2 answers

I do not know if this helps but I have made further observations. So, as you all know, we can create test multiple ways as listed below.

#1 Create a new test using Jira UI by selecting test type as Automated[Generic] & then run cURL command to import results

[My observations]

  • created test via jira ui
  • imported the results
  • no duplicate test is created

#2 Create a new test using REST API by setting test type as Automated[Generic] & then run cURL command to import results

[My observations]

  • created test via REST API
  • imported the results
  • duplicate test is created

#3 Create a new test by cloning an automated test which got created as a results of importing results from REST API & then  run cURL command to import results

[My observations]

  • created a new test by cloning an existing test which got created as a result of importing result. i have ensured the test definition field is populated as required.
  • import the results for this new test
  • no duplicate test is created

As far as I can tell, there is no difference between the test which I create via UI and the test which I am creating  via REST API. They look exactly the same. This is #2 scenario where it is creating duplicate test.

After lot of debugging, I found the root cause and it is so trivial but causes big issue. Not sure if this is a bug??

Anyways, here is the thing.

When we create a test of type Automated[Generic] using Jira app UI or the test gets created via import results API, the test definition field holds the value of classpath+'.'+classname value, but with a space in the beginning of the text.

But when I was creating a test via create issue api endpoint and I was populating the definition field, I was not giving a space at the beginning of classpath+'.'+classname value because I was not even aware that Jira/Xray adds a space in the beginning.

So, I tested by giving a space to the test definition field in the json payload and creating a test and then trying to import the results for the same test, I see that duplicate test is not created.

Hi @srinathbhaskaran

To clarify some points, when you are importing JUnit execution results and you don't have the Tests for these results, previously created on your Jira (we try to find it using the Generic test Definition field), Xray will try to create the Tests. If you have required fields for the issue type Test, Xray is not able to create the Tests.

JUnit’s Test Cases are identified by the pair of attributes “classname” and “name” attributes. Test Cases are imported to Xray’s Generic Test issues, and the “classname” and “name” attributes are concatenated and mapped to the Generic Test Definition field of the Generic Test.
If a Test already exists with the same Generic Test Definition, then it is not created again.

Best Regards,

Team Xray

Hello @José Domingues _Xpand IT_ ,

Have one more question on the same lines. I have parameterized methods due to which now my test case will have 'n' entries with "name" attribute having brackets and the parameters in it. How to handle this kind of situation when importing JUnit results? Because the test remains the same just the parameters fed to the test differs

Suggest an answer

Log in or Sign up to answer

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you