I cloned https://github.com/SonarSource/sonar-examples.git then opened a command prompt under SonarSource/sonar-examples/tree/master/projects/languages/csharp and run the following commands (based on "Unit Test Execution Results Import (C#, VB.NET)" @ docs.sonarqube.org/pages/viewpage.action?pageId=6389772):
MSBuild.SonarQube.Runner.exe begin /k:"org.sonarqube:csharp-simple-sq-scanner-msbuild" /n:"C# :: Simple Project :: SonarQube Scanner for MSBuild" /v:"1.0" /d:sonar.cs.xunit.reportsPaths="%CD%\XUnitResults.xml"
MSBuild.exe /t:Rebuild
packages\xunit.runner.console.2.1.0\tools\xunit.console.exe XUnitProject1\bin\Debug\XUnitProject1.dll -xml %CD%\XUnitResults.xml
MSBuild.SonarQube.Runner.exe end
Under metric/tests/list I get "Unit Tests 1" and that is OK but beneath it the list is empty:
Why?
The relevant part from console:
INFO: Sensor org.sonar.plugins.csharp.CSharpUnitTestResultsProvider$CSharpUnitTestResultsImportSensor
INFO: Parsing the XUnit Test Results file C:\workspace\SonarSource-sonar-examples-92828b2\projects\languages\csharp\XUnitResults.xml
INFO: Sensor org.sonar.plugins.csharp.CSharpUnitTestResultsProvider$CSharpUnitTestResultsImportSensor (done) | time=15ms
SonarQube 5.6 w embedded h2 (extra plugins: C# 5.3, StyleCop 1.1)
SonarQube C# docs says "Drilldown on Test Execution Results is not supported Tests execution results will be displayed on project level dashboards."
There is an open ticket about this problem: https://jira.sonarsource.com/browse/SONARNTEST-17 and this another one is also worth to look: https://jira.sonarsource.com/browse/SONARMSBRU-233
So now I think it is a limitation of the C# plugin and not a bug or configuration issue.