Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

...

...

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

...

Panel
panelIconIdatlassian-info
panelIcon:info:
bgColor#FFBDAD

Starting October 11, 2024 (Zephyr Enterprise 8.2), the Zephyr Enterprise documentation moved from its current location on Atlassian to a dedicated, standalone Zephyr Enterprise documentation page. Please see: https://support.smartbear.com/zephyr-enterprise/docs/en/migrating-to-zephyr-enterprise/via-rest-api/create-a-test-case-tree.html

Table of Contents

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:

...

Code Block
languagejson
{
  "tcrCatalogTreeId": 18,
  	"testcase": {
    		      "name": "Testcase in Sub-Folder"
                    }
}

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

...

Code Block
languagejson
{
    "id": 49,
    "tcrCatalogTreeId": 18,
    "revision": 0,
    "stateFlag": 0,
    "lastModifiedOn": 1588074263271,
    "versionNumber": 1,
    "createDatetime": 1588074263271,
    "createdById": 1,
    "modifiedById": 1,
    "testcase": {
        "customProperties": {},
        "customProcessedProperties": {},
        "id": 31,
        "name": "Testcase in Sub-Folder",
        "lastModifiedOn": 1588074263243,
        "creationDate": 1588057200000,
        "createDatetime": 1588074263271,
        "tcCreationDate": "04/28/2020",
        "creatorId": 1,
        "lastUpdaterId": 1,
        "automated": false,
        "customFieldProcessed": false,
        "customFieldValues": [],
        "testcaseSequence": {
            "seqNumber": 29
        },
        "testcaseId": 29,
        "versionNumber": 1,
        "projectId": 1,
        "testcaseType": "ORIGINAL",
        "requirementIds": "ORIGINAL",
        "requirementIds": [],
        "requirementIdsNew": [],
        "automatedDefault": false,
        "testcaseShared": false
    },: [],
        "requirementIdsNew": [],
        "automatedDefault": false,
        "testcaseShared": false
    },

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.

Expand
titleUpload the file using a cURL command

1. Download cURL and extract the zip file.

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

Image Added

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.

Image Added

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

Expand
titleUpload the file via Postman

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:

Image Added
Note

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:

Image Added

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

Code Block
[{
   "name": "js1.pdf",
   "itemId": 553,
   "itemType": "testcase",
   "contentType": "application/octet-stream",
   "tempPath": "%2F1522663583732_106%2Fjs1.pdf"
}]

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.)

...