Hi,
Jira automation question.
I'm using https://xray.cloud.getxray.app/api/v2/graphql to get the related tests of a test execution. This works fine and I get the correct result.
{data={getTestExecutions={results=[{issueId=188800, jira={key=TEST-13621}, tests={results=[{issueId=180163, jira={key=TEST-11939, summary=Add sales order, assignee=null}}, {issueId=180164, jira={key=TEST-11940, summary=Mandatory field validation, assignee=null}}]}}]}}}
But now I want to iterate through the results/related tests.
I'm using advanced branching
and {{xrayTests.body.asJSON.data.getTestExecutions.results.first.tests.results}} as smart value.
xrayTests is a variable of {{webResponse.body}}.
But, this is not working, I get error
Hi @Dieter Lauwers
Welcome to the Atlassian Community!
The issue is likely that xrayTests contains {{webResponse.body}} as a string, so Automation can't navigate it as a JSON object. I would branch directly over the response instead.
{{webResponse.body.data.getTestExecutions.results.first.tests.results}}
Set the Advanced Branch variable to something like xrayTest.
Inside the branch you can then use
{{xrayTest.jira.key}}
{{xrayTest.jira.summary}}
If you need to keep xrayTests as a variable, convert it first using jsonStringToObject().
{{jsonStringToObject(xrayTests).data.getTestExecutions.results.first.tests.results}}
Regards,
Gor
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.