Update Test Step Status
To change the status of a test step, send a PUT request to /rest/zapi/latest/stepResult/{step-id}
with a JSON body specifying the desired status.
Request URL
PUT /rest/zapi/latest/stepResult/{step-id}
The step-id parameter specifies the identifier of the desired test step. See how you can get this ID.
Request body
The request body contains a JSON object with the status
property that specifies the execution status to assign, for example:
{ "status": 3 }
The status
property uses an integer value to specify the desired status. Below are typical statuses and their IDs. Please note that your Zephyr Squad instance can use other constants. For information on how to get info on available statuses, see below.
Value | Status |
---|---|
| UNEXECUTED |
| PASS |
| FAIL |
| WIP |
| BLOCKED |
Other request parameters
Every request must include authentication parameters. See Zephyr Squad Server REST API.
Example
Operation reference
Get status IDs
To get information on all available test step statuses, send a GET request to /rest/zapi/latest/util/teststepExecutionStatus
(use the same authentication parameters you use for other requests).
The response body will contain an array of objects, each of which has info on a status, for example:
[ { "id": -1, "name": "UNEXECUTED", "description": "The test has not yet been executed.", "color": "#A0A0A0", "type": 0 }, ... ]
The id
property stores the status identifier, the name
property – the status name.
Response
A successful response has the HTTP status 200 OK
. Its body contains the JSON object with properties of the test step whose status you’ve changed, for example:
{ "id": 769, "stepId": 12337, "status": "3", "comment": "", "htmlComment": "", "executionId": 14061, "executedBy": "JIRAUSER10000", "totalStepResultsCount": 2, "executionDefectCount": 0, "stepDefectCount": 0, "totalDefectCount": 0 }
Description of response properties
Property | Description |
---|---|
| Number. The test execution ID. |
| Number. The special identifier that Zephyr uses to form the test execution order. It changes every time you reorder test executions in their folder or cycle. |
| Number. Specifies the ID of the test execution status (UNEXECUTED, WIP, and others). For information on getting the status IDs and names, see above. |
| Number. The ID of the test execution to which the test step belongs. |
| The Jira ID of the user who started the test execution. |
| The test step’s comment in the plain text format. |
| The test step’s comment in the HTML format. |
| Number. The total number of executions of the test step. |
| The number of Jira items linked to the test execution to which the given test step belongs. |
| The number of Jira items linked to all test steps of the test execution to which the given test step belongs. |
| The total number of Jira items linked to the test execution to which the test step belongs (that is, this number is the sum of stepDefectCount and executionDefectCount). |
In case of an error, the server returns 4xx or 5xx response code. The response body contains the description of the error (with certain exceptions). Here are some examples:
If Zephyr has no test step with the ID specified in the request path, the response is
400 Bad Request,
and the response body contains the following data:{ "generic": "Error executing test. Please correct the input and try again." }
If the status ID specified in the request body does not exist, the response is
400 Bad Request,
and the response body contains the following data:{ "status": 1, "message": "Invalid Step status 1234 passed." }
Invalid JSON data in the request body causes an error on the server. In this case, the response will be
415 Unsupported Media Type
or500 Internal Server Error
. In the latter case, the response body will also contain the exception text and call stack.If the request has invalid authentication parameters, the response status will be
20O OK,
and the response body will have the following:{ "errorDesc": "You do not have the permission to make this request. Login Required.", "errorId": "ERROR" }