- SonarQube 6.5
- Need to display Number of Unit testing cases on the SonarQube Dashboard
- Applied settings as per documentation.
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.
Please find the below details:-
I’m using OpenCover for NUnit test.
E:\tools\sonar-scanner-msbuild-184.108.40.2064-net46\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.org\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-220.127.116.114-net46\SonarScanner.MSBuild.exe end
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) .
thanks for the reply.
I’ve tried few alternatives, but didn’t work.
Not sure, which additional property/settings needs to add.
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.