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

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

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.

1 answer

@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.

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

Thank you @Sergio Freire 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.

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 .

I will write on Xray Support

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
Community showcase
Published in Marketplace Apps & Integrations

5 mobile apps for Jira Cloud to boost productivity

  It’s very important to have access to the workflow process from anywhere. Especially if you manage the work of others. There is no difference whether you’re out of office, or drive a ca...

216 views 2 5
Read article

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