How to get Test Plan Test Executions from Xray with API?

Amin Mohammadi
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 18, 2024

I’m trying to retrieve the statuses of test executions using the Jira API, but I’m having trouble. Here’s the process we follow:

1. Run a JQL query to get the parent issues:

(issue in testPlanTestExecutions(TEST-1308798) or issue in testPlanTestExecutions(TEST-1259334)) and (createdDate <= "2024/05/30" and createdDate >= "2024/05/01" )

2024-12-18_104553.png

2. Open one of the parent issues to view the executions.

2024-12-18_104934.png

I’ve attempted to do this, but I can’t seem to get the statuses as shown in the image.

API: /rest/api/latest/search

Request body:

 

{
    "jql": "(issue in testPlanTestExecutions(TEST-1308798) or issue in testPlanTestExecutions(TEST-1259334)) and (createdDate <= \"2024/05/30\" and createdDate >= \"2024/05/01\"  )",
    "fields": [
        "key",
        "customfield_27209",
        "customfield_27214"
    ],
    "maxResults": 10
}

 

I want to fetch the statuses as a list, rather than one by one. Is this possible?

1 answer

Suggest an answer

Log in or Sign up to answer
0 votes
Manuel
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.
December 18, 2024

 

Hi @Amin Mohammadi

you need to get the testRuns object, and the status within it.

Something like this, adapting it to your use case:

 

 query

{

getTestExecutions(jql: "key=CALC-3352", limit: 1) {

results{

issueId

jira(fields: ["key"])

testRuns(limit: 100){

results{

id

status{

name

description

}

comment

testType{

name

kind

}

evidence{

filename

downloadLink

}

defects

executedById

startedOn

finishedOn

assigneeId

unstructured

customFields {

id

name

values

}

test {

issueId

jira(fields: ["key"])

projectId

}

}

}

}

}

}

 

Amin Mohammadi
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 18, 2024

Where should I run this query in script runner or in database directly?

Stefan Salzl
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 17, 2025

Hi @Amin Mohammadi 

this is a graphQL query. You could run this directly or from any API tool like postman.

see the link to documentation below:

https://docs.getxray.app/display/XRAYCLOUD/GraphQL+API

 

Best
Stefan

TAGS
AUG Leaders

Atlassian Community Events