问题描述
我们使用 Jenkins 构建 C# 项目,运行单元测试 (NUnit) 和代码覆盖率 (NCover).作为输出,coverage.nccov
和 nunit-result.xml
文件.
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 触发 SonarQube 分析(SonarQube 5.0.1 和最新的 C# 插件).SonarQube 仪表板显示单元测试覆盖率和单元测试结果,但无法将失败测试列表显示为向下钻取.
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.
当用户点击指标时,显示的页面是空的(没有文件列表,没有钻取,只有指标).
When user clicks on the metrics, the page displayed is quite empty (no list of files, no drilldown, just the metric).
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.
推荐答案
这确实是插件的一个已知限制,这取决于这张票:https://jira.sonarsource.com/browse/SONARCS-657
This indeed is a known limitation of the plugin, which depends on this ticket: https://jira.sonarsource.com/browse/SONARCS-657
请注意,实现此功能的主要困难在于单元测试报告不包含指向源代码文件的链接,而仅包含指向程序集/类型/方法的链接.SonarQube 需要知道在钻取中显示哪些文件.
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.
这篇关于没有从 SonarQube 单元测试成功小部件向下钻取的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!