How to upload the attachments to the Test Case/Test Cycle/Test Plan and Test Case-Test Step execution?

Note: For uploading attachment at Test Case/Test Cycle/Test Plan use the following API params.

  • For Test Case: testCaseId & versionNo

  • For Test Cycle: testCycleId

  • For Test Plan: testPlanId

  • For Test Case/Test Step execution: testcaseExecutionId or teststepExecutionId

Given is the example for uploading attachment to the Test Case execution level.

Step 1: Run the API Get Test Case Execution attachment credentials

  • Method: GET

  • URL: https://qtmcloud.qmetry.com/rest/api/latest/testcycles//testcase-executions/attachments/url?fileName=&projectId=&testcaseExecutionId

The output of the above API would always be unique. Once you are done with the API call, copy the response from the output param (acl tox-amz-Meta-test-case-exe-id) as shown in the screenshot.

Steps 2: Run the below API for uploading the attachments.

  • Method: POST

  • Use the endpoint URL generated from the Step1 API response. I.E - https://qtm4j-cloud-prod-4.s3.amazonaws.com

  • Switch to ‘Body’ tab and select ‘form-data’. Click on ‘Bulk Edit’ option located at the top right corner of the form-data section and paste the copied response of the Step1 API .

  • Remove the double quotation marks, commas, and blank space in the body of the current API. It should look like as shown in the screenshot below.

  • Add an additional parameter as file: filename as shown in the highlighted part in the screenshot. Select parameter format as ‘File’ which will allow you to upload the file to Postman.

 

In this way, the user can upload the attachments to the Test Case execution screen.