Anders
Anders

Reputation: 15397

Getting code coverage in Sonar but no test results (.Net)

I'm re-using reports in my sonar config:

sonar.gallio.mode=reuseReport
sonar.gallio.reports.path=gallio-report.xml
sonar.gallio.coverage.reports.path=results.xml

I've previously run Gallio and OpenCover and can confirm that both completed successfully and that Sonar is able to retrieve the files (I've checked the log produced by the -X flag thoroughly). When I view the project in the sonar dashboard, I see code coverage, but not test results:

Code Coverage

Kindly ignore the low code coverage percentage, I'm running a small subset of tests while I figure this out.

I should see something that reflects the results I saw when I ran Gallio:

14 run, 13 passed, 1 failed (1 error), 0 inconclusive, 0 skipped

I'm happy to include the gallio-report.xml if that's helpful, but it's 103kb so clearly it contains plenty of data, and I think this is more likely to be a configuration issue.

I'm running OpenCover 4.0.1118 and Gallio 3.2.750 (tests are written with NUnit).

Any thoughts why I don't see any test results?

Upvotes: 3

Views: 5169

Answers (1)

Chances are that you don't have the test sources in your .NET solution, so when SonarQube tries to import the test execution results, it can't find to which files they should be attached.

In the .NET sample solution, you can see that there is a test project (Example.Core.Tests) which contains the sources of the test classes.

Upvotes: 4

Related Questions