Howard Shane
Howard Shane

Reputation: 956

Azure DevOps REST API: how to get release stage's test results?

I have a Azure DevOps release pipeline which contains 10+ stages (environments). Each release stage will run a set of test cases for example, BVT Test Stage, Performance Test Stage, etc.

Now, I would like to automatically query the test results from each of the test stage, by REST API.

I can use "Runs" API to query the test runs for this release; I can use "Release" API to query the release stages including their stage names.

But the problem is, I am not able to link the test result from the test run back to the release stage.

For example, I have release stages like "BVT Test", "Performance Test", etc. But the test result from test run is something like "VSTest_TestResults_2234523"

Thanks!

Upvotes: 1

Views: 2480

Answers (2)

Howard Shane
Howard Shane

Reputation: 956

Each test run has a member points to the release's environmentId.

        $stageName = $stageTable[$($oneRun.release.environmentId)]

Upvotes: 0

Mengdi Liang
Mengdi Liang

Reputation: 18958

how to get release stage's test results?

Try with below api:

GET https://vstmr.dev.azure.com/{org name}/{project name}/_apis/testresults/resultdetailsbyrelease?releaseId={release id}&releaseEnvId={environment id}&api-version=5.2-preview.1

To get the test result of one specific environment, you must provide the environment id, along with its corresponding release id.

enter image description here

Upvotes: 3

Related Questions