I’m trying to automate reporting of test case result to our JIRA.
I’m able to do this, via the XRAY API when having an test plan reference as an input.
I get the test execution, with “/rest/raven/1.0/api/testplan/{testplan}/testexecution” and in the next step getting existing tests with “/rest/raven/1.0/api/testplan/{testplan}/test”. Now I connect existing tests with our results and upload them with “/rest/raven/2.0/import/execution”.
The problem is that need to start with an test execution instead and from there get test plan.
When opening the web page for the test execution “https://xxx/browse/XXXX_XXX-41825” there is an field in the top that refers to the Test Plan but how can I get this information using the API?
I have tried to open the page with curl but and locate the data but that does not work, it’s not there in the output. I also looked at the traffic in the browser to see who this data is fetched, without any luck. It is already part of the initial reply.
Is there an API I can use?
Hi @Magnus
You can use the JIRA rest endpoint.
BASE_URL/rest/api/2/issue/ISSUE_KEY_TEST_EXEC
You will have to only query for the custom field named Test Plan using the field ID.
https://confluence.atlassian.com/jirakb/how-to-find-any-custom-field-s-ids-744522503.html
The value is an array of 1 value.
Regards
Thanks for the excellent answer.
I was able to retrieved what I needed with (My test bash snippet):
resp=$(curl -s -H "Accept: application/json" -H "Authorization: Bearer ${token}" https://${url}/rest/api/2/issue/XXXX_XX-41825)
testplan=$(echo "${resp}" | jq -r '.fields.customfield_18045[0]')
echo "testplan=$testplan"
/Magnus
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.