Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

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,554,391
Community Members
 
Community Events
184
Community Groups

Xray Rest API call to import Test Execution Result

Edited

Hi,

I know this query has been answered in so many post but those have not helped me. I did research, and tried, but still facing issue in making an API call to import test execution result.

Approach I took:

  1. Created Test(Test Details: Cucumber), Test Precondition, Test Set, Test Plan and Test Execution
  2. Exported Test using "Xray - Export to Cucumber" option
  3. Added this in my BDD-Cucumber framework, executed and it has generated me cucumber.json file after execution

Trying API call using postman

Approach 1: /api/v1/import/execution/cucumber 

curl --location --request POST 'https://xray.cloud.xpand-it.com/api/v1/import/execution/cucumber' \
--header 'Authorization: Bearer $token’ \
--header 'Content-Type: application/json' \
--data-binary '@/Users/aranjan/Downloads/cucumber.json'

Error:

{ "error": "Error creating Test Execution - Team is required."}

Now, this means it is trying to create new instead of update existing 

Then, I used

Approach 2: /api/v1/import/execution/cucumber/multipart

curl --location --request POST 'https://xray.cloud.xpand-it.com/api/v1/import/execution/cucumber/multipart' \
--header 'Authorization: Bearer $token’ \
--form 'info=@/Users/aranjan/Downloads/xrayresultimport.json' \
--form 'result=@/Users/aranjan/Downloads/cucumber.json'

Error:

{ "error": "Unexpected field (result)"}

xrayresultimport.json

{
"fields": {
"project": {
"key": "HYP"
},
"customfield_10962": [
"Team","TeamQAAuto"
],
"issuetype": {
"id": "10722"
}
}
}

Approach 3: /api/v1/import/execution

curl --location --request POST 'https://xray.cloud.xpand-it.com/api/v1/import/execution' \
--header 'Authorization: Bearer $token’ \
--header 'Content-Type: application/json' \
--data-raw '{
    "testExecutionKey": "HYP-3313",
    "info" : {
        "startDate" : "2020-09-25T11:47:35+01:00",
        "finishDate" : "2020-09-25T11:53:00+01:00",
        "testPlanKey" : "HYP-3341"
    },
    "tests" : [
        {
            "testKey" : "HYP-3330",
            "start" : "2020-09-25T11:47:35+01:00",
            "finish" : "2020-09-25T11:50:56+01:00",
            "comment" : "Successful execution",
            "status" : "PASSED"
        }
     ]
}'
{ "error": "Error updating Test Execution - Issue update failed!"}

 Agenda:

I want to import the execution result in my existing Test Execution.

I request you to guide me here.

Thanks in advance.

2 answers

0 votes
Harish Ekambaram
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
Apr 06, 2023

There is still an alternative way to upload test results, which involves multiple cucumber JSON files. These JSON files contain an array of feature test results. Instead of uploading multiple files or merging them sequentially, you can merge the first array in all the test results to form a JSON file that contains an array of all the test results. After that, you can try to invoke the API to upload the test results. This will create a single test execution with all the test results from different feature files.

Sergio Freire - Xblend
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.
Oct 09, 2020

@Ashish.Ranjan ,

the multipart endpoint always creates new Test Execution issues. The standard endpoint allows you to update an existing one or create new ones.

So, currently, there isn't a solution for updating results on an existing Test Execution while at the same time customize fields on the Test Execution.

 

Remember that you can always reach out Xray support and the team will support you throughout the issue you're facing and others.

Sergio Freire - Xblend
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.
Oct 09, 2020

I would recommend also to vote on this suggestion related to this: https://jira.xpand-it.com/browse/XRAY-6221 

Thank you @Sergio Freire - Xblend for this insight.

 

the multipart endpoint always creates new Test Execution issues. The standard endpoint allows you to update an existing one or create new ones.

I have attempted this in my Approach 2. And for this also, I am getting error.

As updating card is not going to give me desired result, I wanted to work on multipart approach.It would be a great help if you let me know where am I going wrong with multipart approach.

 

the multipart endpoint always creates new Test Execution issues. The standard endpoint allows you to update an existing one or create new ones.

Updating card is falling for me as I have a custom field in the Test Execution issue type. Understood.

 

I have voted on the raised issue.

 

Thanks for your support.

Sergio Freire - Xblend
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.
Oct 19, 2020

Hi @Ashish.Ranjan

You'll need to provide us more information so I recommend you reach out Xray support and the team will be glad to help you out.

 

Best Regards,

Sérgio.

Sure @Sergio Freire - Xblend .

I will write on Xray Support

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events