'How to write individual step results in Zephyr(Jira) using ZAPI(REST API)
I have looked at the ZAPI documentation, and so far I can get the test cycle id and execution id, so I can execute the test case , write the result for test case in Zephyr. However, I have more test steps in the test case. Now I want to write the results of individual test steps into Zephyr(Jira). Can you please provide sample code for the same(Java preferred). Please a sample code would be helpful.
Approach I have till now: (Found on net)
Get the id's of the stepresults(teststep results) by execution ID using the API "/rest/zapi/latest/stepResult" Then using these stepresult Id's we can execute them with PUT request using API "/rest/zapi/latest/stepResult/{id}"
version I am currently using: jira_version:6.3.12 zfj_version:2.5.2 zapi-1.5.0.15001732.obr Thanks, Ahmed
Solution 1:[1]
First, you need to find a test step execution ID and you will get step execution ID by execution ID.
You will get execution ID from below: {{JiraUrl}}/rest/zapi/latest/execution { "issueId": 123455, "versionId": "{versionId}", "cycleId": "123", "projectId": {ProjectId} }
For every issue, there is a different execution ID Extract a value of "id" from the list of executions corresponding to the issue key.
Now, get step id from below: /rest/zephyr/latest/stepResult?executionId={id}
Extract a value of "id"
To change the status of a test step, send a PUT request to /rest/zapi/latest/stepResult/{id} with a JSON body specifying the desired status.
{ "status": 3 }
Status | Value => -1 | Unexecuted , 1 | Pass , 2 | Fail , 3 | WIP , 4 | Blocked
Solution 2:[2]
You need to start the execution and run the navigator ap: https://jira/rest/zapi/latest/execution
https://jira/rest/zapi/latest/execution/navigator/{{execid}}?zql=fixVersion = 'API'&offset=0&maxrecords=0&expand=executionStatus,checksteps&_=1416925447577
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | |
| Solution 2 | JerryBringer |
