Update Test Execution Status

To change the status of a test execution, send a PUT request to /rest/zapi/latest/execution/{id}/execute with a JSON body specifying the desired status.

Request URL

PUT /rest/zapi/latest/execution/{id}/execute

The id parameter specifies the identifier of the desired test execution. 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 all available statuses, see below.

Value

Status

-1

UNEXECUTED

1

PASS

2

FAIL

3

WIP

4

BLOCKED

Other request parameters

Every request must include authentication parameters. See Zephyr Squad Server REST API.

Example

cURL (Windows)

curl --request PUT http://15.20.184.119:8089/rest/zapi/latest/execution/14061/execute ^

--user "admin:password" ^

--header "Content-Type:application/json" ^

--data "{\"status\": 3}"

Operation Reference

go.gif

https://zephyrsquadserver.docs.apiary.io/#reference/executionresource/update-execution-details/update-execution-details

Get status IDs

To get information on all available execution statuses, send a GET request to /rest/zapi/latest/util/testExecutionStatus. For the request, 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 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 execution whose status you’ve changed. For example:

{    "id": 14061,    "orderId": 13670,    "executionStatus": "3",    "executionWorkflowStatus": null,    "executedOn": "21/Dec/21 4:39 PM",    "executedOnVal": 1640133540000,    "executedBy": "admin",    "executedByDisplay": "admin",    "comment": "",    "htmlComment": "",    "cycleId": 178,    "cycleName": "myCycle",    "folderId": 379,    "folderName": "myFolder",    "versionId": -1,    "versionName": "Unscheduled",    "projectId": 10100,    "createdBy": "JIRAUSER10000",    "createdByDisplay": "admin",    "createdByUserName": "admin",    "modifiedBy": "JIRAUSER10000",    "createdOn": "20/Dec/21 6:05 PM",    "createdOnVal": 1640052300000,    "issueId": 24600,    "issueKey": "PROJ-19",    "summary": "My sample test ",    "issueDescription": "<p>This is my sample test.</p>",     "label": "",    "component": "",    "projectKey": "PROJ",    "canViewIssue": true,    "isIssueEstimateNil": true,    "isExecutionWorkflowEnabled": true,    "isTimeTrackingEnabled": true,    "executionDefectCount": 0,    "stepDefectCount": 0,    "totalDefectCount": 0,    "executionSummaries": "{\"executionSummary\":[{\"count\":0,\"statusKey\":-1,\"statusName\":\"UNEXECUTED\",\"statusColor\":\"#A0A0A0\"},{\"count\":1,\"statusKey\":1,\"statusName\":\"PASS\",\"statusColor\":\"#75B000\"},{\"count\":0,\"statusKey\":2,\"statusName\":\"FAIL\",\"statusColor\":\"#CC3300\"},{\"count\":1,\"statusKey\":3,\"statusName\":\"WIP\",\"statusColor\":\"#F2B000\"},{\"count\":0,\"statusKey\":4,\"statusName\":\"BLOCKED\",\"statusColor\":\"#6693B0\"},{\"count\":0,\"statusKey\":5,\"statusName\":\"STATUS IN NEW CUSTOMM\",\"statusColor\":\"#003300\"},{\"count\":0,\"statusKey\":6,\"statusName\":\"A1\",\"statusColor\":\"#9966ff\"},{\"count\":0,\"statusKey\":7,\"statusName\":\"A1\",\"statusColor\":\"#66ff66\"},{\"count\":0,\"statusKey\":8,\"statusName\":\"5.6.2\",\"statusColor\":\"#000000\"},{\"count\":0,\"statusKey\":9,\"statusName\":\"Q1\",\"statusColor\":\"#33ffff\"}]}",    "totalExecutions": 2,    "totalExecuted": 2}

Description of response properties

Property

Description

Id

Number. The test execution ID.

orderId

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.

executionStatus

Number. Specifies the ID of the test execution status (UNEXECUTED, WIP, and others). For information on getting the status IDs and names, see Update Test Execution Status.

executionWorkflowStatus

The Jira workflow status of the test execution. Typically, null.

executedOn

String. Specifies the date and time of the test execution.

executedOnVal

A number that encodes the execution date and time. Can be helpful in automated processing.

executedBy

The Jira ID of the user who started the test execution.

executedByDisplay

String. The name of the user who started the test execution.

comment

The test execution’s comment in the plain text format. This comment is visible, for example, in the Details view of the cycle or folder, or on the view page of a Test issue in the Test Executions section.

htmlComment

The test execution’s comment in the HTML format. See above for information on how to view the comment.

cycleId

Number. The ID of the test cycle to which the test execution belongs.

cycleName

String. The name of the test cycle to which the test execution belongs.

folderId

Number. The ID of the folder to which the test execution belongs.

folderName

String. The name of the folder to which the test execution belongs.

versionId

Number. The ID of the project version to which the test execution belongs (version or release). -1 means no version is used.

versionName

String. The name of the project version to which the test execution belongs (version or release).

projectId

Number. The Jira ID of the project to which the test execution belongs. Jira uses this ID for its internal operations. Don’t confuse it with the project key (see below).

projectKey

String. The “visible” identifier of the Jira project to which the test execution belongs. Project keys are part of issue keys. For example, in the PROJ-1234 issue key, PROJ is the project key.

createdBy

The Jira ID of the user who created the test execution.

createdByDisplay

String. The name of the Jira user account that created the test execution.

createdByUserName

String. The name of the user who created the test execution.

modifiedBy

The Jira ID of the user who changed properties of the test execution last time.

createdOn

String. Specifies the date and time when the test execution was created.

createdOnVal

Number. The encoded date and time of the test execution creation.

issueId

Number. The Jira ID of the Test issue to which the test execution corresponds (see Adding Tests to Test Cycles). Typically, this ID is used internally. In the UI, you refer Jira items by their keys (see below).

issueKey

Number. The key of the Test issue to which the test execution corresponds. Issue keys typically look like PROJ-1234.

summary

The Summary field value of the Test issue.

issueDescription

The value of the Description field of the Test issue.

label

The labels of the Test issue.

component

The value of the Components field of the Test issue.

canViewIssue,

isIssueEstimateNil,

isExecutionWorkflowEnabled,

isTimeTrackingEnabled,

Boolean values that reflect attributes of the Test issue to which the test execution corresponds. These values are for internal use.

defects

An array of JSON objects that has information on Jira items linked to the test execution. If the execution has no linked items, the property is absent.

executionDefectCount

The number of Jira items linked to the test execution, but not to its test steps.

stepDefectCount

The number of Jira items linked to all test steps of the test execution.

totalDefectCount

The total number of Jira items linked to the test execution and to its test steps (that is, this number is a sum of stepDefectCount and executionDefectCount).

customFields

A JSON object with the names and values of custom fields the test execution has.

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 executions with the ID specified in the request path, the response is 400 Bad Request, and the response body contains the following data:

    {
      "error": "Error in creating Execution, please check value of 123455678 and retry"
    }
  • If the request specifies a status ID that does not exist, the response is 400 Bad Request, and the response body contains the following data:

    {
    
    "status": 1,
    
    "message": "Invalid Test 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 or 500 Internal Server Error. In the latter case, the response body will 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"
    
    }

See Also

Zephyr Squad Server REST API

Update Test Step Status

Publication date: