1
votes

I have a classic build pipeline in Azure DevOps that builds and run tests for a .Net Core 3.1 app. I am using self-hosted build agents running Windows Server 2019 OS

Below is the pipeline screenshot enter image description here

My tasks:

  1. Restore Nuget
  2. Build the solution in release mode
  3. Install latest vstest.console.exe tool
  4. Run tests using above tool and generate .coverage file
  5. Install CodeCoverage.exe from Nuget
  6. PowerShell script to convert .coverage to .xml
  7. Using ReportGenerator task to generate HTML and Cobertura (HTMLInline;HTMLChart;Cobertura)
  8. Publish the code coverage results to the server using Cobertura.xml from step 7 and also uploading HTML report folder

Publish Code Coverage Task enter image description here The HTML report directory is generated by ReportGenerator task.

Build runs successfully Publish Code Coverage task log enter image description here

Build run summary

enter image description here

Published files by the build

enter image description here

Code Coverage tab

enter image description here

Issue: The code coverage tab does not display the HTML reports

2
Hi @Prado, How about the issue? Does the answer below resolved your question? If not, would you please let me know the latest information about this issue?Vito Liu
This issue is still open. What I understand from the responses below is that if we use "Visual Studio Test" task in the build then that somehow prevents uploading HTML reports later in the pipeline. This is not confirmed yet. I am waiting for someone to provide more concrete response. I am not looking for "Coverlet" option here.Prado
Could you try the answer and then kindly share the result here?Vito Liu

2 Answers

1
votes

This is a known issue on Azure devops. Now, we could only download the report, and open it with Visual Studio.

Azure devops only support the download link for .coverage files currently. The white page you see is a UI glitch. This scenario is only supposed to render a download link to the coverage file.

Besides, this issue has been submitted in this earlier suggestion ticket linked here: support vstest .coverage "code coverage" build results tab

This feature request is On Roadmap, I believe it will be released soon, you can follow this thread to know its latest feedback.

In addition, I found a similar case and I have tested via the answer, set the code coverage tool to Cobertura, then I get the code coverage report in the Azure DevOps pipeline.

enter image description here

0
votes

I don't see you settings so I will share mine which works

enter image description here

enter image description here