Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How I can get the test run Id from XRAY execution

Sumit Tyagi February 23, 2025

I have created the XRAY Test execution and inside this I have added the test cases. 
Now I have marked the test cases failed or pass according to the validation results. 

Now I want to know the test run Id of the test cases inside the test execution, so that I can upload the screenshot to it

2 answers

Suggest an answer

Log in or Sign up to answer
0 votes
Humashankar VJ
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 24, 2025

Hi @Sumit Tyagi 

The GET /rest/raven/1.0/api/testrun?testExecKey endpoint is not supported in Xray Cloud, which instead utilizes a GraphQL API for retrieving test runs. To obtain the Test Run ID in Xray Cloud, you can use the GraphQL API with a query similar to the one provided below:

{

getTestRun(testIssueId: "33920", testExecIssueId: "33922") {

id } }

To execute this query, send a POST request to https://xray.cloud.getxray.app/api/v2/graphql, including the necessary headers such as Authorization and Content-Type.

For automating tasks like screenshot upload, bug creation, and linking in Xray Cloud, follow these steps:

First, upload the screenshot to the Test Run using the provided POST request.  

Next, create a bug in Jira using the Jira Cloud REST API.

  • Finally, link the bug to the failed test case using the Jira API to create an issue link. Implement this workflow after each test execution, ensuring that
  • Results are updated,
  • Screenshots are uploaded,

Bugs are created, and links are established as necessary.

Hope this helps - Happy to help further!!
Thank you very much and have a great one!
Warm regards

0 votes
Humashankar VJ
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 23, 2025

Hi @Sumit Tyagi 

You can give a try with the Xray REST API, you'll need to have the Test Execution Key, such as XT-1234.

  • Once you have this key, you can make the following API call to fetch the test runs.
  • Simply use the GET request "GET /rest/raven/1.0/api/testrun?testExecKey=XT-1234", replacing XT-1234 with your actual Test Execution issue key.

Hope this helps - Happy to help further!!
Thank you very much and have a great one!
Warm regards

Sumit Tyagi February 23, 2025

HI @Humashankar,

Thanks for the reply...

Currently am using the import/execution api t update the test result in xray.cloud api.

having below questions: 
1.  Do 'GET /rest/raven/1.0/api/testrun?testExecKey' this API supported with the jira.atlassian.cloud
2. am facing the below challenge. In automation....
after every test am calling the import/execution API to update the test results in the xray, then i need to upload the screenshot and create a bug in case of failure and link to the test case inside execution. 

Like Humashankar VJ likes this
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events