【问题标题】:NUnit results not showing up in SonarQube after import导入后 NUnit 结果未显示在 SonarQube 中
【发布时间】:2018-05-03 18:03:29
【问题描述】:

当我使用 MSBuild 扫描仪分析 .NET 项目时,我无法真正看到我的 NUnit 报告是否被导入到 SonarQube 报告套件中。

我正在运行带有用于 MSBuild 2.0 和 C# 插件 v5.0(以及其他不相关插件)的 SonarQube 扫描仪的 SonarQube 5.4

d:\buildTools\sonar-runner-for-msbuild\MSBuild.SonarQube.Runner.exe begin 
                                       /k:$productKey 
                                       /n:$productName 
                                       /v:$BuildNumber 
                                       /d:sonar.cs.nunit.reportsPaths=$NunitTestOutput

虽然我为 nunit.xml 报告传递了正确的路径,但它并没有被导入到 SonarQube 上的报告包中:

我导航到(project home) -> Dashboards -> Custom dashboard(我在其中添加了单元测试覆盖率小部件),但除了测试数量之外没有其他信息。

可以肯定的是,日志还显示分析器知道 nUnit 报告的确切位置,但它也没有显示失败或成功的迹象。

2016.05.11 09:28:09 INFO  [o.s.s.c.t.CeWorkerCallableImpl] Execute task | project=[Redacted-project-name] | id=[redacted]
[...]
2016.05.11 09:28:11 INFO  [o.s.s.c.s.LogScannerContextStep] Settings for module: [Redacted-module-name]
[...]
2016.05.11 09:28:11 INFO  [o.s.s.c.s.LogScannerContextStep]   - sonar.cs.fxcop.reportPath=E:\WS\12500236\source\src\[Redacted-module-name].dll.CodeAnalysisLog.xml
2016.05.11 09:28:11 INFO  [o.s.s.c.s.LogScannerContextStep]   - sonar.cs.nunit.reportsPaths=E:\WS\12500236\_testoutput\nunit.xml
2016.05.11 09:28:11 INFO  [o.s.s.c.s.LogScannerContextStep]   - sonar.cs.roslyn.reportFilePath=E:\WS\12500236\source\src\[Redacted-module-name].dll.RoslynCA_fixed.json
[...]
2016.05.11 09:28:29 INFO  [o.s.s.c.t.CeWorkerCallableImpl] Executed task | project=[Redacted-project-name] | id=[redacted] | time=20328ms

我应该寻找什么?我错过了什么?

我在关注this guide 来导入 NUnit 报告。

【问题讨论】:

    标签: sonarqube nunit sonarqube-msbuild-runner


    【解决方案1】:

    NUnit 没有内置覆盖。您需要使用其他工具来计算覆盖率。

    code coverage results 上查看 Sonar 的文档

    【讨论】:

      猜你喜欢
      • 2018-03-21
      • 2020-01-09
      • 1970-01-01
      • 2016-12-13
      • 2017-12-11
      • 1970-01-01
      • 2016-02-16
      • 2021-06-18
      • 2016-10-31
      相关资源
      最近更新 更多