I want a API endpoint which will give the test case latest run status

Viewed 34

community,

I am new to Azure DevOps Rest Api Services([https://docs.microsoft.com/en-us/rest/api/azure/devops/test/results/get?view=azure-devops-rest-6.0&tabs=HTTP&source=docs]). I want an endpoint which will give the test case latest run status as response where I will pass PAT token as base64 encoded. Please support.

1 Answers

I am afraid that there is no out-of-box method can directly get the latest test run of the test case.

In Azure DevOps Test Plan, the test run will be related to the test point.

Test Plan -> Test suite -> Test Case -> Test Point -> Test Run

You can use the Rest API: Points - List to get the latest test run of the test point.

GET https://dev.azure.com/{organization}/{project}/_apis/test/Plans/{planId}/Suites/{suiteId}/points?testCaseId={testCaseId}&testPointIds={testPointIds}&api-version=6.0

Then you can get the latest test run id.

Next step, you can use the Rest API: Runs - Get Test Run By Id to get the Test Run status.

GET https://dev.azure.com/{organization}/{project}/_apis/test/runs/{runId}?api-version=6.0

You can use the Test Run ID from the previous Rest API response to the Rest API to get the detailed info of the test run.

Related