Finding all test executions for a specific testplan in Jira Xray using JQL

I’m working on automating the creation of executions in Jira Xray and I’m stuck. I need to find a way to get all test executions for a particular testplan using JQL. I have the testplan key, but I can’t figure out how to construct the query. It’s weird because you can easily see the executions when you open the testplan in the UI. However, when using the API, the testplan issue doesn’t have any direct links to its executions. The relationship only goes one way. Has anyone dealt with this before? I’m hoping there’s a JQL trick I’m missing. Any help or ideas would be really appreciated. I’ve been banging my head against this for a while now!

I’ve dealt with this exact problem in my previous project. The tricky part is that Xray doesn’t expose the test execution-testplan relationship directly in JQL, which is a pain.

Here’s what worked for me: instead of querying for test executions directly, I queried for test runs associated with the testplan, then used those to find the executions. The JQL would look something like this:

‘Test Plan’ = TPL-123 AND issuetype = ‘Test Run’

This gives you all the test runs for your testplan. From there, you can use the Xray API to fetch the associated test executions for each run.

It’s not as straightforward as we’d like, but it gets the job done. Just be prepared for some extra API calls and data processing on your end. Hope this helps you get unstuck!

I’ve encountered this issue before, and it can be frustrating. The key is to use the ‘testPlanKey’ field in your JQL query. Here’s a JQL that should work for you:

issuetype = ‘Test Execution’ AND ‘Test Plan’ = TPL-123

Replace ‘TPL-123’ with your actual testplan key. This query will return all Test Executions linked to that specific Test Plan.

One caveat: make sure you have the necessary permissions to view both the Test Plan and its associated Test Executions. Sometimes, permission issues can cause unexpected results.

If you’re still having trouble, double-check that your Xray version supports this field. Older versions might require a different approach.

hey dave, i feel ur pain! xray can b a real headache sometimes. have u tried using the ‘testPlanKey’ field in ur JQL? something like:

issuetype = ‘Test Execution’ AND ‘Test Plan’ = TPL-123

replace TPL-123 with ur actual key. if that doesn’t work, maybe try querying for test runs first, then link those to executions? good luck!