Table of Contents |
---|
...
Code Block | ||
---|---|---|
| ||
{ "tcrCatalogTreeId": 18, "testcase": { "name": "Testcase in Sub-Folder" } } |
tcrCatalogTreeId - the ID of the folder where you want to create the test case.
...
Code Block | ||
---|---|---|
| ||
{
"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": [],
"requirementIdsNew": [],
"automatedDefault": false,
"testcaseShared": false
}, |
Add an attachment
Prerequisites
Before adding an attachment, you need to perform the following:
1. Upload the file you want to attach to the server 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 | ||
---|---|---|
| ||
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:
<file path> - the location of the file to be uploaded. <ip> - the IP address of the server. Example: 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: |
Expand | ||
---|---|---|
| ||
1. Download the Postman Chrome extension. 2. After adding the Postman extension, launch Postman. Method : POST URI : 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:
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.)
...