1

I have the problem that the code coverage for some reason aren't presented in Sonar. The result of the unit tests is performed and showed correctly but not the result of the code coverage. The project is build by Jenkins. I have registered the opencover.profiler.dll file as suggested in some threads but still I get no result. Neither I get any error messages in Jenkins when performing the build.

I would be most grateful for any tips on what to do.

Best regards Dan

Dan
  • 11
  • 2
  • This kind of problem can occurs if the assemblies were compiled somewhere and the Sonar analysis occurs elswhere. In this case, the PDB files contains paths that are not valid in the 2nd place. Can you check this point? You'll be able to clearly see this when looking inside the coverage XML file. – Fabrice - SonarSource Team Oct 25 '12 at 15:24
  • The thing though is that I have a valid result in the coverage-report.xml file, but nothing is presented in Sonar. /Dan – Dan Oct 31 '12 at 10:37

3 Answers3

2

I think this happens because your Jenkins service is running as "Local System account", but Sonar is running OpenCover with the -register:user switch under the hoods. You should be able to bypass this either by running the Jenkins service as a regular user account, or patch the Sonar-runner to omit the -register:user switch.

  • Jenkins service is using a local admin account. It turned out however that the PDB-files caused the problems. They were included in the repository and were for some reason not recreated by the build in Jenkins. The PDB-files therefor contained the wrong path to the actual code files. – Dan Nov 01 '12 at 15:46
0

It turned out however that the PDB-files caused the problems. They were included in the repository and were for some reason not recreated by the build in Jenkins. The PDB-files therefor contained the wrong path to the actual code files.

Thanks for the help!

Dan
  • 11
  • 2
0

Check for version conflicts between OpenCover and the Gallio plugin.

I found that the later versions of OPenCover (starting with Version 4.0.1229) inserted a new tag in the coverage-report.xml file - which the Gallio plugin could not understand. When I rolled back to an older version of OpenCover (4.0.804) the coverage worked again. You can find more details on http://sonar.15.n6.nabble.com/coverage-report-xml-is-generated-but-sonar-says-coverage-is-0-td5008850.html

It looks like the Gallio plug-in has been updated, but I haven't pursued that yet (wanted to first confirm that this was the cause of the problem).