Back to QMetry All Products Help Page
How to update test case/ test step result for a Test Run using Open API?
Considering a scenario, When executing a Test Run manually, there is an option to pass/fail/block etc to each test case and test step. How can these test case/step results be updated using the Open API? Here's how you do it.
Steps for getting testResultId of test case:
For updating the test case result, requires testResultId. We need to run below API:
Post /testrun/testexecution/:testRunIssueId
Description
POST Test Cases/Scenarios and Stories linked with the given test run along with their summary and status.
Example
- Get testRunIssueId from test run.
- Execute the API mentioned above by specifying the value for testRunIssueId and use the following body parameters.
Body:
{"projectId":"10001", "offset":0, "automationRun":true, "whereClause":[], "assignedToUsers":[], "executionResult":[], "testScenarioWithDefectRequired":false }
See the output :
Steps for getting testResultId of test steps:
We can get the testResultId of the test steps, if you want to update the execution result of the test steps. We need to run below API.
Post /testrun/testexecution/:testRunIssueId/:testResultId
Description
POST Test Steps which are linked with Test Case.
Example
- Need to specify testRunIssueId, testCaseIssueId for making an API call. Refer an attachment.
- See the output:
Steps for updating execution result for test case & test steps:
Now we have testResultId for both test case and test steps, need to proceed with updating test case/ test steps execution result. As indicated in very first attachment - test case and all associated test steps are marked as NOT EXECUTED Let's update test case as PASS and associated test steps as BLOCKED & FAIL using below API.
PUT /testrun/{testRunIssueId}/update
Description
You can update either comment, actual result, execution result or all of them together. Here you can directly pass test result id or multiple issue ids. Here is the help document for this API in detail.
Example
- Specify testRunIssueId in Parameters and JSON inside Body part. We need to add the "result" and "testResultId" attributes in the API in order to update the execution status of the test case & test steps. Refer to attachments.
- See the final Output with updated execution results.
Note: In order to automatically propagate Test Step execution result to Test Case, enable 'Automatically propagate Test Step execution result to Test Case' under Execution Preferences in QMetry Configuration.
Back to QMetry All Products Help Page