Forum Discussion

lokessri's avatar
lokessri
Occasional Contributor
4 years ago

Api to get executions based on testcase key/id in zephyr scale

Hi Team,   I need an API to get executions based on test case key/id in zephyr scale   UI in Jira is somehow able to get this information as shown below, however I am unable to get the same data ...
  • josh42's avatar
    4 years ago

    Hi lokessri ,

    there is a way to do this using the internal API, but you must be aware that it is not supported or documented for public use which means, that you might run into undocumented changes down the line. You can also break a lot of stuff using the internal API but in your case ist's just a simple GET so no need to worry. 😉

     

    You can use the following endpoint to get the results for a test case by its internal id.

     

    .../jira/rest/tests/1.0/testcase/<test case id>/testresults?fields=testResultStatus(name,i18nKey,color),environment(name),key,userKey,assignedTo,jiraVersionId,estimatedTime,executionTime,executionDate,automated,testRun,testCase,issueLinks,sprint(name)

     

    This will return the same info you can see in the test case. Using the fields parameter you can filter the info you get. So if you only want the test cycle and execution key for example, it would be ?fields=key,testRun.

     

    To get the test case id from its key, you can use this.

    .../jira/rest/tests/1.0/testcase/<test case key>?fields=id

     

    Hope, this helps.

    Cheers

    Josh