Forums

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

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.

2 answers

Suggest an answer

Log in or Sign up to answer
1 vote
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:

0 votes
Ash H_
June 9, 2026

Hi Adeel,

I'm Ash from Appfire, it looks like Christos has you covered. I thought I'd jump in with an alternate solution.

To make this much easier within Jira itself, JQL Search Extensions provides specialized functions that bridge these gaps. Specifically, you can use functions like `linkedIssuesOfQuery` or `linkedBy` to find issues associated with your Test Executions based on their link types. This is particularly helpful for manual-triggered automation because you can save these precise queries as filters. These filters can then be called by your external scripts or used to power Jira dashboards that track exactly which tests are queued for execution. By using these extensions, you gain the ability to search for issues based on their relationships and metadata that standard JQL simply can't reach, ensuring your automation has the exact list of test cases it needs every time.

Since you mentioned manual-triggered automation involving Azure, TFS4JIRA can further streamline this workflow by keeping your Jira issues and Azure DevOps work items in sync. If your automation results or triggers live in Azure DevOps, TFS4JIRA allows for bi-directional synchronization of fields, statuses, and comments. This means that when a test is updated in Jira via your Xray automation, the corresponding work item in Azure DevOps can be updated automatically, maintaining a single source of truth across both platforms without manual data entry.

Best wishes,
Ash

JQL Documentation 



Christos Markoulatos -Relational-
Community Champion
June 9, 2026

thanks @Ash H_ good to know this as well!

TAGS
AUG Leaders

Atlassian Community Events