jBravo
jBravo

Reputation: 883

SonarQube : nUnit's results are not displayed

I'm using SonarQube and Jenkins. In Jenkins, I check the unit tests with nUnit and the coverage with opencover. The opencover's report is displayed in Sonar but the nunit's report is not. The Unit Tests count is not even displayed in the home page of the project.

Here is what I do :

  1. Build my VisualStudio project with MSBuild
  2. Run nunit and opencover with a batch command line
  3. Run SonarQube scanner's analysis
  4. Package the project

The Step 2's command line :

MKDIR "%WORKSPACE%\reports"
MKDIR "%WORKSPACE%\reports-history"

SET COV_PTH="D:\Programmes\opencover.4.5.3522"
SET TOOL_PATH="D:\Programmes\NUnit-2.6.4"
SET RPT_PATH="D:\Programmes\ReportGenerator"

copy src\Foo.Bar.Tests\app.config build\Foo.Bar.Tests.dll.config

%COV_PTH%\OpenCover.Console.exe "-filter:+[Foo.Bar*]* -[Foo.Bar.Tests]* -[Foo.Bar.Service]* -[Foo.Bar.Domain]* -[Foo.Bar.Dal]Foo.Bar.Dal.Dao.* -[Foo.Bar.Controller]Foo.Bar.Controller.*Comparer -[Foo.Bar.Controller]Foo.Bar.Controller.External.*" -register "-target:%TOOL_PATH%\bin\nunit-console.exe" -targetargs:"build\Foo.Bar.Tests.dll /noshadow /result=reports\TestResult.xml" -output:reports\opencovertests.xml

%RPT_PATH%\ReportGenerator.exe "-reports:reports\opencovertests.xml" "-targetdir:reports-ReportGenerator" "-historydir:reports-history"

The Step 3's parameters :

sonar.projectKey=FooBar
sonar.projectName=FooBar
sonar.projectVersion=%SVN_REVISION%
sonar.sources=src/Foo.Bar.Controller, src/Foo.Bar.Dal, src/Foo.Bar.Domain, src/Foo.Bar.Fichier, src/Foo.Bar.Generation, src/Foo.Bar.Reporting, src/Foo.Bar.Service, src/Foo.Bar.Web
sonar.binaries=Build/Foo.Bar.Controller.dll, Build/Foo.Bar.Dal.dll, Build/Foo.Bar.Domain.dll, Build/Foo.Bar.Service.dll, Build/Foo.Bar.Fichier.exe, Build/Foo.Bar.Generation.exe, Build/Foo.Bar.Reporting.exe
sonar.tests=src/Foo.Bar.Tests
sonar.cs.opencover.reportsPaths=reports/opencovertests.xml
sonar.cs.nunit.reportsPaths=reports/TestResult.xml

EDIT

I also tried the following process (same results) :

  1. Prepare SonarQube scanner's analysis
  2. Build my VisualStudio project with MSBuild
  3. Run nunit and opencover with a batch command line
  4. End SonarQube scanner's analysis
  5. Package the project

END EDIT

The nUnit's report is well generated in workspace/reports/TestResult.xml.

I tested the analysis generation by command line and via the sonarqube plugin for jenkins. I got the same results.

Can you see anything wrong?

Is there any SonarQube's logs that I could checked ?

I am using Jenkins 2.10, MSBuild 12, SonarQube 5.6, SonarQube scanner for Jenkins plugin 2.4.3, opencover 4.5 and nunit 2.6.4

EDIT

I updated my config : Jenkins 2.18, MSBuild 14, SonarQube scanner for Jenkins plugin 2.4.4. Same results.

END EDIT

Upvotes: 2

Views: 2108

Answers (1)

JosephS
JosephS

Reputation: 764

Take a look at: SonarQube documentation: Unit Test Execution Results Import (C#, VB.NET)

It says:

Drilldown on Test Execution Results is not supported

My understanding is that you can only see the results (number of Tests passing, errors, etc) but not detail from the tests.

You also ask about Logs. You have:

Upvotes: 2

Related Questions