Is it possible to access the test execution result in a task in Azure Pipelines through a variable?

Viewed 21

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.

1 Answers

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.

Related