Search code examples
code-coveragesonarqube-4.5opencoversonarqube-msbuild-runner

Sonarqube coverage with opencover and Nunit


We are currently using Sonarqube 4.5.7 (SonarQube Scanner for MSBuild 2.1) with Nunit and Opencover. Test execution is successful and metrics correctly reported in dashboard. But coverage section in Sonar dashboard is blank and coverage xml shows "Module skippedDueTo="MissingPdb"" for my application module

Below is the configuration I have used in my Jenkins

"C:\Program Files (x86)\MSBuild\14.0\Bin\msbuild.exe" sample\app.sln /t:Rebuild /p:Configuration=Debug
"C:\Program Files (x86)\OpenCover\OpenCover.Console.exe" -register:user -targetdir:"…\sample\app.Tests\app.Correction\bin\Debug" -target:"C:\Program Files (x86)\NUnit 2.6.4\bin\nunit-console.exe" -targetargs:" …\sample\app.Tests\app.Correction\bin\Debug \app.dll /nologo /noshadow" -output:coverage.report.xml

Solution

  • Finally we found solution for this problem. In this case it was indeed a problem with quotes, wrapping the complete targetargs, as shown below fixed the problem

    "-targetargs: …\sample\app.Tests\app.Correction\bin\Debug \app.dll /nologo /noshadow"