Sonar, Multiple Coverage Tools overwriting each other

1.1k views Asked by At

If I run DotCover I get a Unit test coverage report, if I use CodeCoverage I get Unit Test Coverage report.

I use DotCover for XUNIT, however we still have legacy MSTEST/VSTEST I use with CodeCoverage.exe

However if both are run with the sonar-runner, the only one that shows is code coverage (seems to run second). Is there a way to have 2 sections show in SONAR when you run separated coverage files?

If not, is there a way to merge these somehow into one? I am assuming this isn't a trivial task?

I want to see both coverage's at one time, without having to re-import the project into sonar twice.

Thanks ahead of time, Mark

2

There are 2 answers

1
Fabrice - SonarSource Team On

You can use only one coverage tool, not several ones. Obviously, you can use DotCover for project Foo, and MS TEST for project Bar. But not both at the same time.

1
Dinesh Bolkensteyn On

You can merge multiple code coverage reports, regardless of whether or not they have been generated by the same tool.

Just add something similar to this to your sonar-project.properties:

sonar.cs.dotcover.reportsPaths=dotCover.html sonar.cs.vscoveragexml.reportsPaths=VisualStudio.coveragexml

See also the example C# project: https://github.com/SonarSource/sonar-examples/tree/master/projects/languages/csharp

However, you cannot distinguish in the SonarQube UI the code coverage coming from dotCover from the one coming from CodeCoverage.exe: They will have been merged