Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 19:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to get the test plan of a test case using json (/rest/raven/1.0/import/execution) ?

Cyril November 29, 2024

Hello,

we need to have the list of test plans linked to a test case (using test case id) with 

POST - /rest/raven/1.0/import/execution command?

Thanks.

1 answer

1 accepted

0 votes
Answer accepted
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.
December 1, 2024

Hi @Cyril 

To retrieve a list of test plans linked to a test case, utilize the Xray API.

 You can query test executions associated with the test case by using the following endpoint: GET /api/v2/testexec?jql=test=your_test_case_id. In the response, look for the testPlanKey field, which identifies the linked test plans.

Note that the /rest/raven/1.0/import/execution endpoint is specifically designed for importing test execution results and is not suitable for retrieving linked test plans.

By leveraging the Xray API, you can efficiently fetch the test plans related to your test case.

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

 

Cyril December 1, 2024

Hello,

thanks a lot for your help.

In fact, I need to use the test case id to be able to find the test plan without using the test execution (which does not yet exist).

Do you have any idea?

Thanks.

Like Humashankar VJ likes this
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.
December 2, 2024

@Cyril 

Retrieve the details of TEST-123.

GET /rest/api/2/issue/TEST-123

Identify that the custom field customfield_18045 represents the test plan.

url -X GET \

  https://your-jira-instance.atlassian.net/rest/api/2/issue/TEST-123 \

  -H 'Authorization: Bearer your-api-token' \

  -H 'Content-Type: application/json'

Extract the value of customfield_18045, which might be TP-1.

In the response JSON

{

  "fields": {

    "customfield_18045": ["TP-1"]

  }

}

Optionally, retrieve more details about TP-1 if needed.

GET /rest/api/2/issue/TP-1

Best Regards

Cyril December 16, 2024

Hello,

issue solved.

Thanks.

Like Humashankar VJ likes this

Suggest an answer

Log in or Sign up to answer