Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
  • Community
  • Q&A
  • Jira
  • Questions
  • How to retrieve Test Cases from a Test Execution in Xray Cloud for manual-triggered automation (Azur

How to retrieve Test Cases from a Test Execution in Xray Cloud for manual-triggered automation (Azur

Adeel nikama
June 8, 2026

I am working with Xray Cloud on Jira Cloud (hosted on the Atlassian domain, not self-hosted) and I am trying to implement a manual-triggered automation workflow. My Goal / Architecture

I want to implement the following workflow:

A new build is deployed to a pre-production environment.

A Test Plan is created.

Multiple Test Executions are added to the Test Plan.

Each Test Execution contains multiple Test Cases.

A Jira user manually triggers an Automation Rule on a specific Test Execution.

The automation should:

Retrieve all Test Cases linked to the current Test Execution.

Extract a custom field from each Test Case (External ID).

Build a string parameter (comma- or pipe-separated).

Send this parameter to an Azure DevOps pipeline.

After execution, the Azure DevOps pipeline sends the test results back to the corresponding Test Execution using its Issue ID.

Current Problem

I am unable to reliably retrieve the Test Cases associated with a specific Test Execution.

I have tried:

JQL queries

Jira REST API

Various AI-suggested approaches

But none of them return the Test Cases as expected.

Questions

In Xray Cloud, what is the correct way to retrieve all Test Cases linked to a specific Test Execution (via automation or REST API)?

Is my overall architecture (Test Plan → Test Execution → Manual trigger → Azure DevOps → Results back to Test Execution) a good approach?

Is there a better or more standard integration pattern for Xray Cloud and Azure DevOps pipelines?

Any guidance would be greatly appreciated.

1 answer

0 votes
Christos Markoulatos -Relational-
Community Champion
June 8, 2026

Hi @Adeel nikama 

The reason JQL and the Jira REST API aren't working here is that on Xray Cloud, they have no awareness of Xray's internal relationships at all. The GraphQL API is the only way to get Xray data in Cloud, a lot of the custom field relationships from Server/DC just didn't make it over. So those approaches were never going to work for this.

ou need to hit the Xray GraphQL endpoint at https://xray.cloud.getxray.app/api/v2/graphql. First authenticate with your Xray API client ID and secret against POST /api/v1/authenticate to get a bearer token, then use getTestExecution with the Jira issueId (the numeric internal ID, not the issue key) and pull the nested tests connection. The query looks like this:

{
getTestExecution(issueId: "YOUR_ISSUE_ID") {
issueId
jira(fields: ["key"])
tests(limit: 100) {
total
results {
issueId
jira(fields: ["key", "customfield_XXXXX"])
}
}
}
}

Replace customfield_XXXXX with the field ID for your External ID field, you can grab it from the Jira REST API fields endpoint if you don't have it. That gives you all the linked test cases with the custom field values, which you join into your comma/pipe-separated string and pass to the ADO pipeline trigger.

For the Jira Automation side, use a Manual trigger scoped to Test Execution issues, then a "Send web request" action to call the GraphQL endpoint with {{issue.id}} as the issueId. Chain a second web request to fire the ADO build API with the extracted IDs. On the ADO side, your pipeline receives the test IDs as input, runs the build, and posts results back to Xray using the Test Execution issue key as the target. If the Automation rule's response parsing isn't flexible enough for the GraphQL transformation, drop a small intermediary in between — an Azure Function works well for this.

Your overall architecture is solid, this is a well-established pattern.

Hope this helps!

Helpful links:

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events