'How to get test coverage percentage on Azure Pipeline?

I have coverlet.collector installed in my project. Then I have added the below into my Yaml file.

  - task: DotNetCoreCLI@2
    inputs:
      command: test
      projects: '**/*unittests/*.csproj'
      arguments: '--configuration $(buildConfiguration) --no-restore /p:CollectCoverage=true 
      /p:CoverletOutputFormat=cobertura' displayName: 'Run backend unit tests'

This only returns me the number of tests passing or failing - but not the % of code covered.

enter image description here

Does anyone have a reference of how I can get the % code coverage?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source