Create a Test Case Tree

Create a folder or phase

Use the following operation to create a folder or phase in Zephyr Enterprise:

POST /flex/services/rest/v3/testcasetree?parentid=0&assignedusers=

Request format

To create a folder or phase, send a POST request to the following URL:

http://{ZEPHYR-SERVER}/flex/services/rest/v3/testcasetree?parentid=0&assignedusers=

Request body

{ "name":"N4", "description":"", "type":"Phase", "releaseId":1 }

releaseId - the ID of the release.
For information on creating a tree node, see Create Tree Node.

Response body

{ "id": 17, "type": "Phase", "name": "N4", "description": "", "revision": 0, "categories": [], "assignedUsers": [1,2,3,5,6,7,8], "releaseId": 1, "linkedTCRCatalogTreeId": 0, "createdOn": 1588073471630, "createdBy": 1, "lastModifiedBy": 1, "lastModifiedOn": 1588073471641, "testcaseCount": 0, "cumulativeTestcaseCount": 0 }

Create a sub-folder or sub-phase

Use the following operation to create a sub-folder or sub-phase in Zephyr Enterprise:

POST /flex/services/rest/v3/testcasetree?parentid={ID of the parent folder}

Request format

To create a sub-folder or sub-phase, send a POST request to the following URL:

http://{ZEPHYR-SERVER}/flex/services/rest/v3/testcasetree?parentid={ID of the parent folder}

Request body

{ "name":"Sub Folder", "description":"", "type":"Module", "releaseId":1 }

releaseId - the ID of the release.
parentid - the ID of the parent folder of the sub-folder you want to create.
For information on creating a tree node, see Create Tree Node.

Response body

Create a test case

Use the following operation to create a test case in Zephyr Enterprise:

POST /flex/services/rest/latest/testcase/

Request format

To create a test case, send a POST request to the following URL:

http://{ZEPHYR-SERVER}/flex/services/rest/latest/testcase/

Request body

tcrCatalogTreeId - the ID of the folder where you want to create the test case.

For more information on creating test cases, see Create Test Case.
Response body

Add an attachment

Prerequisites

To attach a file to a test case, you need to upload it to the server. To do that:

1. Upload the file as a multi-request to /flex/upload/document/genericattachment via a cURL command or Postman. This will return the file name and location in the JSON format.

1. Download cURL and extract the zip file.

2. Open the command prompt and navigate to the src folder containing the curl.exe executable:

3. Run the following cURL command:

curl -i -X POST -H "Content-Type: multipart/form-data" -F "data=@<file path>" http://<ip>/flex/upload/document/genericattachment

<file path> - the location of the file to be uploaded.

<ip> - the IP address of the server.

Example: curl -i -X POST -H "Content-Type: multipart/form-data" -F "data=@C:/Users/Praveenkumar/Downloads/js1.pdf" http://52.74.143.162/flex/upload/document/genericattachment

4. The above-mentioned command will return the temporary location of the uploaded file in the JSON format. You will use this path in the request body when sending a request.

 

Example: file":"/opt/zephyr/nodedata/temp/1486648889167_29/js1.pdf"

1. Download the Postman Chrome extension.

2. After adding the Postman extension, launch Postman.

Method : POST

URI : http://<server-ip>/flex/upload/document/genericattachment
Example: http://52.74.143.162/flex/upload/document/genericattachment

3. On the Body tab, select form-data.

4. Specify key as data, and for the value select File from the dropdown and choose the file to be uploaded:

Do not provide any headers.

5. Clicking on Send will return the location of the uploaded file in the JSON format. You will use this path in the request body when sending a request:

2. Call the createAttachment API passing the name and location of the uploaded file. On success, the file will be attached.

Attach the uploaded file

To attach the uploaded file to your test case, specify the file path you got upon uploading the file (see above) in the tempPath attribute of a createAttachment API request and send the request.

API operation

POST /flex/services/rest/latest/attachment/list

Request format

To attach an uploaded file to a test case, send a POST request to the following URL:

http://<server-ip>/flex/services/rest/latest/attachment/list

Request body

tempPath - the path to the uploaded file.

On success (HTTP/1.1 200 OK), the file will be attached.

Update an existing test case (update the tag, priority, custom fields, etc.)

Use the following operation to update a test case in Zephyr Enterprise:

PUT /flex/services/rest/v3/testcase/{id}

Request format

To update a test case, send a PUT request to the following URL:

http://{ZEPHYR-SERVER}/flex/services/rest/v3/testcase/{id}

{id} - the ID of the entity you want to update.

Request body

Response body

Create a test step

Use the following operation to create a test step in Zephyr Enterprise:

POST /flex/services/rest/latest/testcase/{testcaseVersionId}/teststep/detail/{tctId}

Request format

To create a test step, send a POST request to the following URL:

http://{ZEPHYR-SERVER}/flex/services/rest/latest/testcase/{testcaseVersionId}/teststep/detail/{tctId}

{testcaseVersionId} - the ID of the test case version.
tctId - test case ID in the test case tree.

Request body

tcId - the test case ID.
maxId - the maximum number of steps.
orderId - the step order ID.

Response body

For more information on test step creation, see Create Test Step.

Update a test step

Use the following operation to update an existing test step in Zephyr Enterprise:

PUT /flex/services/rest/latest/testcase/{testcaseVersionId}/teststep/detail/{tctId}

Request format

To update an existing test step, send a PUT request to the following URL:

http://{ZEPHYR-SERVER}/flex/services/rest/latest/testcase/{testcaseVersionId}/teststep/detail/{tctId}

{testcaseVersionId} - the ID of the test case version.
tctId - test case ID in the test case tree.

Request body

tcId - the test case ID.
maxId - the maximum number of steps.
orderId - the step order ID.

See Also

Migration REST API