Arieltk
Arieltk

Reputation: 121

Codecoverage.exe does not generate output xml

In order to import a coverage file to SonarQube, I'm executing CodeCoverage.exe to convert a ".coverage" file to xml. I execute a cmd line like: CodeCoverage.exe analyze /output:[name of xml file to be generated] [name of the coverage binary file].coverage but I do not get any output xml and no errors. I must say that I was able to generate such xml for tests of other solution files. What can be the problem? How can I troubleshoot it?

Thanks!

Upvotes: 3

Views: 3510

Answers (3)

1_bug
1_bug

Reputation: 5727

I've faced a same problem today and I finally found a workaround: use tools created by one of stackoverflow.com users: @stef-heyenrath:

CoverageConverter - GitHub

In short:

  1. Install CoverageConverter tool by command:

dotnet tool install --global dotnet-coverageconverter

  1. Convert .coverage file to .coveragexml:

dotnet-coverageconverter --CoverageFilesFolder "ProjectName.Tests\TestResults\DirectoryContainsCoverageFile"

  1. Done :)

Generated file it's fully supported by SonarQube btw.

Upvotes: 1

Scott Daly
Scott Daly

Reputation: 41

I encountered this same issue. There should be errors in the event log. What fixed it for me was using an absolute path to the .coverage file. .xml extension for the output file is fine.

Upvotes: 1

Dan M.
Dan M.

Reputation: 39

I would start with making sure you're naming the new file with the extension *.coveragexml

CodeCoverage.exe analyze /output:[name of xml file to be generated].coveragexml [name of the coverage binary file].coverage

Upvotes: 2

Related Questions