简体   繁体   中英

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:

代码覆盖范围

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM