Nunit Reports not shown in Sonarqube

csharp
tests

(Chiemele Akoma) #1

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
  • what are you trying to achieve
  • what have you tried so far to achieve this
    I am using Sonarqube Community Version 6.7.6 (build 38781); Jenkins version 2.164.1; NUnit Console Runner 3.10.0 (.NET 2.0); and SonarScanner.MSBuild version 4.5.0.1761 (command line).
    I am trying to use jenkins to build a large c# project, and publish/view the nunit results in sonarqube, but i can see other analysis, but not the nunit results in sonarqube ui.

Sonar process in jenkins is:

bat label: ‘start-sonar-analysis’, returnStdout: true, script: ‘SonarScanner.MSBuild begin /k:"%JOB_NAME%" /n:"%JOB_NAME%" /v:%buildInfoVersion% /d:sonar.cs.nunit.reportsPaths="%WORKSPACE%\test-results\TestResult.xml"’

bat label: ‘Build-Solution’, script: ‘msbuild Neutrino.sln -t:rebuild -maxcpucount:2 -ds -v:minimal -fl -p:configuration=Release -p:RunOctoPack=true -p:OctoPackEnforceAddingFiles=true -p:OctoPackPackageVersion=%buildInfoVersion% -p:OctoPackPublishApiKey=%OctopusAPIKeyN% -p:OctoPackPublishPackageToHttp=%octopus_nuget_server_url%"’

bat label: ‘NUnit’, script: ‘nunit3-console %testpath% --work="%WORKSPACE%\test-results" --dispose-runners --agents=10 --result=TestResult.xml;format=nunit2’

bat label: ‘end-sonar-analysis’, returnStdout: true, script: ‘SonarScanner.MSBuild end’

from the console in jenkins (see attached txt file), i get no errors with regards to finding the test result xml file or parsing it, but in the sonarqube ui, i am unable to view the results (see attached png)from the test. no coverage was used and none is expected.

Please can you advise what im doing wrong or how to resolve the issue.

jenkins-sonarqube-nunit-console.txt (5.1 KB)


(Andrei Epure) #2

Welcome to our community, @duoarc

Did you remove the warning and info messages from the logs? Could we see those, as well? The interesting bit is to see if the end step finds the test result report and uploads it.


(Chiemele Akoma) #3

thanks @SonarSourcer
i have not removed any relevant warning or info. i have reattached images, only blurring out file name & lines of code.
as stated, i got no errors saying it could upload the testreport.

sonarqube-nunit-5