Octávio Moreira
Octávio Moreira

Reputation: 59

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

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.

Upvotes: 0

Views: 558

Answers (2)

Octávio Moreira
Octávio Moreira

Reputation: 59

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.

Upvotes: 1

qBasicBoy
qBasicBoy

Reputation: 56

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.

Upvotes: 0

Related Questions