Search code examples
unit-testingdockercode-coverageazure-pipelinescobertura

How to install Cobertura in azure Devops?


I have a .net core whith CI in Azure devops.

After successfully running my unit tests, I would like to generate and display code coverage using ReportGenerator, based on this article:

https://www.meziantou.net/computing-code-coverage-for-a-dotnet-core-project-with-azure-devops-and-coverlet.htm

Part of the YAML:

- script: |
dotnet tool install -g dotnet-reportgenerator-globaltool
reportgenerator -reports:$(Build.SourcesDirectory)/**Tests/**/coverage.cobertura.xml -targetdir:$(Build.SourcesDirectory)/CodeCoverage -reporttypes:HtmlInline_AzurePipelines;Cobertura
 displayName: Create Code coverage report

This gives me the folling error:

...line 2: Cobertura: command not found

By removing the Cobertura from reporttypes, there are no errors, but then there are no report to be shown.

How can I install or enable Cobertura?


Solution

  • By removing HtmlInline_AzurePipelines from reporttypes, it worked