I’m running the task below in Azure Pipelines and I needed to access the percentage of tests passing and failing as a result of running this task in another task.
Is this possible to be done? Can I access this result through a variable?
- task: DotNetCoreCLI@2
displayName: Execute Tests
inputs:
command: 'test'
projects: '**BaseProject.dll'
workingDirectory: '$(System.DefaultWorkingDirectory)'
Please can someone help me? Thanks.
2
Answers
The way I found to solve this problem was adding to the test project structure the generation of an xml with the information I needed. With the generated xml I was able to access it through a Powershell task and then save the variables as needed.
unfortunately it doesn’t look like there is a variable that is easily accessible and gets populated by the task.
However the maker of this extension managed to extract that data from the test report and allow you to send an email with the test report and the pass percentage in the subject https://marketplace.visualstudio.com/items?itemName=epsteam.EmailReportExtension
the project is on github https://github.com/microsoft/azure-devops-engineering-extensions you can check how they extracted the pass percentage for the subject line.