'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!
Solution 1:[1]
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.
Solution 2:[2]
Each test run has a member points to the release's environmentId.
$stageName = $stageTable[$($oneRun.release.environmentId)]
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Mengdi Liang |
| Solution 2 | Howard Shane |

