Using SonarQube 7.9.1 and SonarScanner for MSBuild 4.7.1
J:\wks\4c69ee78>C:\jenkins-slave-build\tools\hudson.plugins.sonar.MsBuildSQRunnerInstallation\MSBuild-SonarScanner-default\SonarScanner.MSBuild.exe begin /d:sonar.host.url=**** /d:sonar.login=****** /k:oap-back /n:oap-back /v:0.0.0-unstable00001872 /d:sonar.inclusions=**/*.cs /d:sonar.cs.opencover.reportsPaths="reports\opencover.xml" /d:sonar.cs.xunit.reportsPaths="reports\nunit.xml"
11:57:18 SonarScanner for MSBuild 4.7.1
11:57:18 Using the .NET Framework version of the Scanner for MSBuild
...
J:\wks\4c69ee78>C:\jenkins-slave-build\tools\hudson.plugins.sonar.MsBuildSQRunnerInstallation\MSBuild-SonarScanner-default\SonarScanner.MSBuild.exe end /d:sonar.login=******
...
INFO: Sensor C# Tests Coverage Report Import [csharp]
INFO: Parsing the OpenCover report J:\wks\4c69ee78\.\reports\opencover.xml
INFO: Adding this code coverage report to the cache for later reuse: J:\wks\4c69ee78\.\reports\opencover.xml
INFO: Coverage Report Statistics: 276 files, 276 main files, 276 main files with coverage, 0 test files, 0 project excluded files, 0 other language files.
INFO: Sensor C# Tests Coverage Report Import [csharp] (done) | time=7737ms
INFO: Sensor C# Unit Test Results Import [csharp]
INFO: Parsing the XUnit Test Results file J:\wks\4c69ee78\.\reports\nunit.xml
WARN: Could not import unit test report '.\reports\nunit.xml'
INFO: Sensor C# Unit Test Results Import [csharp] (done) | time=7ms
The coverage report is properly attached to the SQ analysis but not the unit test report, SQ project page shows 0 unit tests.
Is there a way to get more info about what’s the issue with the unit test report? The file exists. Is its format not the expected one? (nunit-version=“xUnit.net 2.4.0.4049”)
FYI if you are exporting the results in NUnit format then you would need to set the sonar.cs.nunit.reportsPaths property.
Does SonarQube show the source code for the test files (which I guess are in Feature.HrefLang.Test.dll)?
Can you confirm that the nunit.xml file contains the expected output i.e. that it contains the expected list of tests, and could you share the file with us?
I switched the xunit report to ‘xml’ format (which xunit .net v2), used xunit jenkins plugin and sonar.cs.xunit.reportsPaths parameter in sonar scanner. Everything works fine with this setup.