0
votes

SonarQube Unit Test Coverage shows no information, everything else seems fine.

Setup

  • Jenkins 2.7.2 master/slave approach (SonarQube process is running on a slave)
  • SonarQube 5.6.1 (fresh install, no other projects running)
  • MS Build Scanner for Jenkins 2.1
  • OpenCover 4.6.519

Small Solutions

Small solutions works fine: Code Analysis, Unit Test Coverage and Unit Test Results show in the dashboard.

Big Solutions

Once I moved to this one big Solution (Contains many Projects):

  • No errors in any log file
  • Jenkins job finishes successfully
  • SonarQube dashboard shows the Code Analysis and the Unit Test results
  • Background tasks are all done, no error in those logs either.
  • I can see the output file from OpenCover being created and being used in the logs
  • Unit Test Coverage shows "-" (hyphen, dash)

There are similar questions to this one, none of the few answers apply in my situation.

I also enabled verbose logs.

1
When you say you can see the output file from OpenCover, can you actually open it? Does it have coverage data in it or is it very small/empty? One thing that you could do is try generating the coverage file from the command line using just OpenCover without using Sonarqube. That way, you can focus on just that one part of the equation. Once you determine OpenCover works as expected, you'll probably have an easier time getting the Sonar part working.Daniel Omoto
@DanielOmoto thank you or you suggestion. The file gets generated, it's about 200mb. I just ran ReportGenerator on it and I'm noticing that it's only running the coverage of the Dll of the project that contains only the tests. The way we have it its we create a project for the code and another project just for the Unit Test. Need to research on that. although, when I mentioned earlier that it works with smaller solutions, those smaller solutions are also structured like that (one project for code, one for unit tests)qazcde

1 Answers

0
votes

It turned out the Server running the Jenkins Slave was running what I guess was an earlier release of Visual Studio 2015 (which installs MSBuild). I updated it to what was available (VS 2015 Update 3) and now I can see the coverage.

It was either that or the fact that I rebooted the Server after the VS update requested for it.

The idea came to me after I installed a local SonarQube in my development box and realized that what I was previously doing was working fine there.