SonarQube C# dashboard Number of Unit test cases missing


(Vinay Bhandari) #1

Must-share information:

(G Ann Campbell) #2


Can you provide the your analysis command line and/or parameters? So you know, SonarQube doesn’t count your unit tests for you, but relies on a report to tell it how many you have. So unless you’re producing that report and feeding it into your analysis, it’s expected that that number is missing.


(Vinay Bhandari) #3

Please find the below details:-
I’m using OpenCover for NUnit test.

E:\tools\sonar-scanner-msbuild-\SonarScanner.MSBuild.exe begin /k:MsBuildDemo /n:MsBuildDemo /v:0.0.1-0-14 /d:sonar.cs.opencover.reportsPaths=Coverage.xml 

"E:\tools\OpenCover\OpenCover.Console.exe" -target:"C:\Program Files (x86)\\nunit-console\nunit3-console.exe" "-targetargs:NUnitTest\bin\Debug\NUnitTest.dll" -filter:"+[Trending]* -[NUnitTest]*" -register:administrator -output:Coverage.xml

"C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe" Trending.sln

E:\tools\sonar-scanner-msbuild-\SonarScanner.MSBuild.exe end

(Nicolas Bontoux) #4


Please use ``` markdown for technical content, to improve readability. I’ve edited your post accordingly.

From what I can see you’re only passing sonar.cs.opencover.reportsPaths, which is for importing coverage data (which is working per your screenshot).

Import of Unit Test results is a different mechanism, with its own properties: Unit Test Execution Results Import (C#, VB.NET) .

(Vinay Bhandari) #5

Hi Nicolas,

thanks for the reply.

I’ve tried few alternatives, but didn’t work.
Not sure, which additional property/settings needs to add.
Any hint?

(Nicolas Bontoux) #6

Without more information/logs I would hardly have more hints then what’s documented here. You’ve mentioned NUnit so sounds like sonar.cs.nunit.reportsPaths is what you’re after. Of course you have to make sure it points to valid NUnit test reports (again, see example commands in the documentation).

Ultimately if some issue remains then a good strategy is to start with a minimal basic example to get confident with parameters and behaviour, before extending to broader codebase.