How to extract the pass percentage summary of builds and release deployments through Rest API? as I would want to compare the results with a threshold and send mails accordingly to the manager for approving to move to next stage deployment.
CodePudding user response:
You can try to leverage the List action of the Test Runs API.
A call to the List action for a certain test run (runId
parameter in the URL) returns an array of TestCaseResult objects. Its outcome
property contains the result of a test case. According to the docs:
Valid values = (Unspecified, None, Passed, Failed, Inconclusive, Timeout, Aborted, Blocked, NotExecuted, Warning, Error, NotApplicable, Paused, InProgress, NotImpacted)
So, you can approach your task in the following way:
- Run the List action for a test run you're interested in
- Parse the response and calculate the number of results where
outcome
property equalsPassed
- Divide that number to the total number of objects in the response array to find out the percentage
NOTE: if there are a lot of tests in the run, you'll have to repeat point #1 with paging URL parameters (top
and skip
) to pull all the results.