hifromantal
hifromantal

Reputation: 1764

NUnit results not showing up in SonarQube after import

I can't really see if my NUnit reports are being imported in to the SonarQube report suite while I am analyzing a .NET project with the MSBuild scanner.

I'm running SonarQube 5.4 with the SonarQube scanner for MSBuild 2.0 and C# plugin v5.0 (and other non-related plugins, as well)

d:\buildTools\sonar-runner-for-msbuild\MSBuild.SonarQube.Runner.exe begin 
                                       /k:$productKey 
                                       /n:$productName 
                                       /v:$BuildNumber 
                                       /d:sonar.cs.nunit.reportsPaths=$NunitTestOutput

While I'm passing in the correct path for the nunit.xml report, it is not being imported into the report suite on SonarQube:

I navigate to (project home) -> Dashboards -> Custom dashboard (where I have added the Unit Tests Coverage widget) but it has no more information other than the number of tests.

Just to be sure, the log also shows that the analyzer knows about the exact location of the nUnit report, but it shows no sign of failure or success either.

2016.05.11 09:28:09 INFO  [o.s.s.c.t.CeWorkerCallableImpl] Execute task | project=[Redacted-project-name] | id=[redacted]
[...]
2016.05.11 09:28:11 INFO  [o.s.s.c.s.LogScannerContextStep] Settings for module: [Redacted-module-name]
[...]
2016.05.11 09:28:11 INFO  [o.s.s.c.s.LogScannerContextStep]   - sonar.cs.fxcop.reportPath=E:\WS\12500236\source\src\[Redacted-module-name].dll.CodeAnalysisLog.xml
2016.05.11 09:28:11 INFO  [o.s.s.c.s.LogScannerContextStep]   - sonar.cs.nunit.reportsPaths=E:\WS\12500236\_testoutput\nunit.xml
2016.05.11 09:28:11 INFO  [o.s.s.c.s.LogScannerContextStep]   - sonar.cs.roslyn.reportFilePath=E:\WS\12500236\source\src\[Redacted-module-name].dll.RoslynCA_fixed.json
[...]
2016.05.11 09:28:29 INFO  [o.s.s.c.t.CeWorkerCallableImpl] Executed task | project=[Redacted-project-name] | id=[redacted] | time=20328ms

What should I look for? What am I missing?

I was following this guide to import the NUnit report.

Upvotes: 2

Views: 517

Answers (1)

Mariusz Jamro
Mariusz Jamro

Reputation: 31643

NUnit doesn't have coverage built-in. You need to use some other tool for calculating the coverage.

See Sonar's documentation on code coverage results

Upvotes: 0

Related Questions