Reputation: 1252
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
My tasks:
Publish Code Coverage Task The HTML report directory is generated by ReportGenerator task.
Build runs successfully Publish Code Coverage task log
Build run summary
Published files by the build
Code Coverage tab
Issue: The code coverage tab does not display the HTML reports
Upvotes: 3
Views: 6509
Reputation: 12321
Your issue lies with step 4.
4. Run tests using above tool and generate .coverage file
If a .coverage
file is created and left alone, Azure DevOps will pick it up and use it over anything else you create later. So basically your coverage.xml
or any generated HTML report is ignored at the Code Coverage tab.
So instead of using VSTest task and whatever you used beneath that, try adding a .Net Core Test to your pipeline and configure it to spit out "XPlat Code Coverage" using coverlet collector. Make sure NOT TO pass in any .runsettings
file via --settings
. Before doing any of that, you will need to add the NuGet coverlet.collector
for all your test projects.
Then add your task to publish the coverage results. You don't need the report generator, it's now built-in.
That's all. Hopefully, you will be able to see the generated HTML getting rendered under Code Coverage tab.
Upvotes: 1
Reputation: 8278
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.
Upvotes: 1
Reputation: 40533
I don't see you settings so I will share mine which works
Upvotes: 0