Forum Discussion
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
- lokessri4 years agoOccasional Contributor
Thanks for the solution Josh, is there a chance to break the system if we build automation surrounding this API, as we are looking to get details based on these APIs and have some gating logic built based on the data rendered by this API.
Load that we are trying to add is about 3000 requests around the span 15 minutesAny inputs will help
- josh424 years agoCommunity Hero
If you stick to GET calls, you'll be fine in terms of breaking stuff with the calls themselves. But as I mentioned, you should check for any undocumented API changes (in a staging environment) before upgrading to a newer version of ZS, so your automation does not suddenly break down.
I don't think, that the load should be a problem, but it depends on your infrastructure. When in doubt, test it out (sorry :P). Just do a quick load test and you'll see, what's what.
Side note: There are, of course, also a lot of internal PUT/POST endpoints and these can be quite dangerous. I once accidentally removed all priorities and statuses from a project. 😄
- egvozdev4 years agoNew Contributor
Hello,
Would you please advice what exact endpoint I should use? i.e. for example
https://jira.com/jira/rest/tests/1.0/testcase/1558/testresults?fields=key,testRun
or
https://jira.com/rest/atm/1.0/testcase/1558/testresults?fields=key,testRun
Both returns 404 😞
I use Jira server 8.13.3 and Zephyr scale 8.7.2
Also - I didn't get test id with request .../testcase/TT-T3?fields=id - got empty {}, so I used Test script id instead (1558) - is it correct?
Thank you
Evgeny
- Michael_Timpe2 years agoNew Contributor
Hi,
this seems to be a solution also for what I am looking for. Can you pls tell me on how to do the authentication for this and which URL has to be addressed. I tried with Jira and Zephyr access token. Both doesn't work. Do I need to take the smartbear URL (app.tm4j.smartbear.com) or the atlassian url (<mycontext>.atlassian.net).
Michael