Sonarqube not showing coverage for nunit test

  • SonarC# Version–sonar-application-8.1.0.31237
  • Visual Studio Version-2017
  • Scanner for MSBuild -4.7.1
  • Csharp plugin -8.2
    To get coverage report for nunit test case.
    Executing these steps:
    Begin
    C:\Users\LENOVO\Downloads\sonar-scanner-msbuild-4.7.1.2311-net46\SonarScanner.MSBuild.exe begin /k:“Util:TestSonarKey” /d:sonar.host.url=“http://localhost:9000” /d:sonar.login="—" /d:sonar.cs.dotCover.reportsPaths=“C:\Users\LENOVO\source\repos\TestApp\AppCoverageReport.html” /d:sonar.cs.nunit.reportsPaths=“C:\Users\LENOVO\source\repos\TestApp\TestResult.xml” /d:sonar.verbose=true

Build

“C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe” /t:Rebuild

nunitStep

C:\Users\LENOVO\source\repos\TestApp\packages\NUnit.ConsoleRunner.3.10.0\tools\nunit3-console.exe “C:\Users\LENOVO\source\repos\TestApp\UnitTestProject1\bin\Debug\UnitTestProject1.dll”

C:\Users\LENOVO\Downloads\JetBrains.dotCover.CommandLineTools.2019.3.1\dotCover.exe analyse /TargetExecutable=“C:\Users\LENOVO\source\repos\TestApp\packages\NUnit.ConsoleRunner.3.10.0\tools\nunit3-console.exe” /TargetArguments=“C:\Users\LENOVO\source\repos\TestApp\UnitTestProject1\bin\Debug\UnitTestProject1.dll” /Output=“AppCoverageReport.html” /ReportType=“HTML”

end

C:\Users\LENOVO\Downloads\sonar-scanner-msbuild-4.7.1.2311-net46\SonarScanner.MSBuild.exe end /d:sonar.login="----"

Please help.

Hello manish,

Could you please add the following property to the begin step: /d:sonar.verbose=true. This will enable to run the analysis with full debug log. Can you please then share the full logs with us, that would help us understand what is going wrong in your case.

Thanks.
Regards,

-Chris

I think, it helps you

.Net Core Unit Test Code Coverage Setting

Hi @hakanaltindis,

Thanks for contributing to our community! We’ll close this topic due to a long inactivity.