7

We use Jenkins to build C# project, to run unit tests (NUnit) and code coverage (NCover). As output, coverage.nccov and nunit-result.xml files.

Jenkins triggers SonarQube analysis (SonarQube 5.0.1 and up to date C# plugin). The SonarQube dashboard displays unit tests coverage and unit tests results, but list of failed tests cannot be displayed as drilldown.

widget

When user clicks on the metrics, the page displayed is quite empty (no list of files, no drilldown, just the metric).

metric detail

sonar-project.properties:

sonar.visualstudio.solution=MyProject.sln
sonar.cs.ncover3.reportsPaths=coverage.nccov
sonar.cs.nunit.reportsPaths=nunit-result.xml

Unit Tests Coverage metrics display drilldown as expected.

test coverage drilldown

1 Answer 1

5

This indeed is a known limitation of the plugin, which depends on this ticket: https://jira.sonarsource.com/browse/SONARCS-657

For your information, the main difficulty to implement this feature is due to unit test reports not containing links back to the source code files, but only to assemblies/types/methods instead. SonarQube needs to know which files to show in the drilldown.

5
  • I understand this limitation. Can you tell me why we can't have the list of unit tests, by namespace or assemblies (with no source code)?
    – Francois
    May 20, 2015 at 15:35
  • SonarQube is designed to report issues on source files, so it won't gather information that lack source code May 22, 2015 at 12:47
  • So, until nunit-results.xml doesn't contains path to source code file, there is no way to display a drill down for unit tests in SonarQube (for C# projects)?
    – Francois
    May 22, 2015 at 12:57
  • until we're not able to do this mapping somehow. adding that information in nunit-results.xml would indeed be one way to get that mapping. May 22, 2015 at 13:54
  • One more issue with C# unit test count: if you going to add javascript tests - c# unit tests not counting anymore @DineshBolkensteyn
    – Boltyk
    Sep 14, 2017 at 16:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.