Search code examples
sonarqubesonar-runnersonarqube-msbuild-runnersonarqube-5.4

VS Unit Test Results file (.trx) is not displayed into SonarQube


I have setup SonarQube with the following:

  • sonarqube-5.4
  • MSBuild.SonarQube.Runner-2.0
  • VS 2013 (target .net framework 4.5.1)
  • SQLServer2014 Express Edition
  • Windows7Professional SP1 64bit OS

I used the above settings and able to publish the code analysis results into SonarQube. I followed the below link to publish the unit test results (.trx) file: http://docs.sonarqube.org/pages/viewpage.action?pageId=6389772

I have added the below tag in the "begin" command to pick up VS unit test results file.

/d:sonar.cs.vstest.reportsPaths="C:\TestResults\\*.trx"

Below parsing details captured from the bottom of console window:

19:48:58.788 INFO  - Sensor org.sonar.plugins.csharp.CSharpUnitTestResultsProvider$CSharpUnitTestResultsImportSensor
19:48:58.798 INFO  - Parsing the Visual Studio Test Results file C:\abc_ABC 2016-04-29 19_45_36.trx
19:48:58.828 INFO  - Sensor org.sonar.plugins.csharp.CSharpUnitTestResultsProvider$CSharpUnitTestResultsImportSensor (done) | time=40ms

But unit test details are not shown in the project dashboard / Code Coverage tab. Are there any settings or configuration needs to be done (C# plugin added already)? How can we see the unit test results in SonarQube?

Please find the attached screenshot for the project dashboard. Where can we see the unit test results ?

On clicking the second tab "Coverage", it shows the message - "This component does not have coverage details."

ProjectDashboard


Solution

  • Based on Mike Barry's comments,

    Go to project level Dashboards menu item --> Custom. It will show unit test results table / widget as well.