How to get the execution status of Test cases linked to a Testsuite via REST API?
Refer a Complete help documentation of Open Rest APIs.
To get the execution status of test cases linked to a test suite via rest API please follow the below steps.
Step 1 - Call the Get Info Service API
Under APIary refer Admin > Get Info Service > Get Info
GET /rest/admin/project/getinfo
Request Headers
- content-type: application/json
- apikey: <Generated Open API key>
- project: <Project Id/Key/Name>
From the response get the following details
- Get the test suite folder ID "id" from the response under "rootfolders":TS
- Get the "viewId" of the test suite from the response under "latestViews": TS and TE
- Get the "id" of the execution status under "allstatus" based on the name.
Step 2 - Get the list of Test Suites
Under APIary refer Test Suite > Fetch Test Suites > Get list
POST /rest/testsuites/list/viewColumns
Request Header
- content-type: application/json
- apikey: <Generated Open API key>
- project: <Project Id/Key/Name>
Request Body
{ "getSubEntities": true, "viewId": <Test Suite view ID captured from Get Info>, "folderPath":"/Project_Name", (for example : Project Name is MAC, then specify "/MAC") "start": 0, "limit": 50, "page": 1 }
Response
- Fetch the "id" of the test suite from the list of all the test suites.
Step 3 - Get list of all Test Executions associated with Test Suite
Under APIary refer Execution > Fetch Executions > Get List
POST : /rest/execution/list/platformHome
Request Headers
- content-type: application/json
- apikey: <Generated Open API key>
- project: <Project Id/Key/Name>
Request Body
{ "tsID": 211487, "page": 1, "start": 0, "limit": 10 }
Response
- Get list of all test suite run IDs : "tsRunID" based on the "tsID" for the combination of release, cycle and platform.
Step 4 - List of all Test Cases filtered by Execution Status
Under APIary refer Executions > Get Test Case Run IDs > Get List
POST /rest/execution/list/viewColumns
Request Headers
- content-type: application/json
- apikey: <Generated Open API key>
- project: <Project Id/Key/Name>
To view the test case runs with all the statuses, remove the filter parameter OR to fetch for a certain status, specify the "runStatusID" fetched from the Get Info Service API call from Step 1.
Request Body
{ "start": 0, "page": 1, "limit": 50, "viewId": 23858, "tsrunID": "448410", "filter": "[{\"value\":[33569],\"type\":\"list\",\"field\":\"runStatusID\"}]", "udfFilter": "[]", "showTcWithDefects": false }
Response
Response Body
{ "data": [ { "tsRunID": 107021, "tcRunID": 6600425, "tcID": 1113999, "tcVersionID": 1130320, "projectID": 1707, "runStatus": "Passed",