Vstest: Enable dotnet test --collect:"Code Coverage" to allow output to xml format

Created on 5 Mar 2019  路  4Comments  路  Source: microsoft/vstest

Thanks for adding code coverage support to the CLI, at least on windows. But because the .coverage files are only really viewable by VS Enterprise it is still quite limited in CICD scenarios - basically azure devops only. If we could output the results in the XML format then lots of external tools could use it, and we could convert them easily to other coverage tool formats - this would unlock a lot of integrations. It is relatively simple to do the conversion but not really supported. Once we have the coverage data in XML format the OSS ReportGenerator tool can do all of the heavy lifting for us. See https://github.com/danielpalme/ReportGenerator/wiki/Visual-Studio-Coverage-Tools

I propose something like:

[default format]
dotnet test app.tests --collect:"code coverage" --collect-format:"coverage"  

[new xml format]
dotnet test app.tests --collect:"code coverage" --collect-format:"coveragexml"
enhancement

Most helpful comment

@alastairtree I would also like to see that feature. (Check https://github.com/Microsoft/vstest/issues/1746, too). I want to get rid of coverlet and that stuff.

All 4 comments

For info, the XML conversation can kinda be done already (only on windows) by using the nuget package Microsoft.CodeCoverage, and then using the exe at [nupgk package path]\Microsoft.CodeCoverage\build\netstandard1.0\CodeCoverage\CodeCoverage.exe
by executing something like the following:

CodeCoverage.exe analyze /output:TestResults\MyTestOutput.coveragexml TestResults\MyTestOutput.coverage

@alastairtree Thanks for the feedback. As you mentioned currently the only way to generate xml is via codecoverage.exe. we don't have any plans to support xml format out of the box for .coverage. Based on feedback/votes we can take a decision on this one.

@alastairtree currently we are working to enable code coverage scenarios on Linux https://github.com/Microsoft/vstest/issues/981. As part of that work we are looking to spit out some other coverage format. But for .coverage format we are not looking to give out an xml format. Closing the issue

@alastairtree I would also like to see that feature. (Check https://github.com/Microsoft/vstest/issues/1746, too). I want to get rid of coverlet and that stuff.

Was this page helpful?
0 / 5 - 0 ratings