无法在SonarQube中看到代码覆盖率

时间:2017-01-25 13:05:36

标签: c# jenkins sonarqube

我无法收集SonarQube覆盖率值。任何人都可以建议我在哪里遗漏任何东西。我可以看到***。Tests.dll文件可用。

enter image description here

Test Files
    C:\AirSearchBnd\src\Fortius.Air.Search.Tests\bin\Debug\WorldVentures.Fortius.Search.Tests.dll

Errors and Failures

1) Invalid : C:\AirSearchBnd\src\Fortius.Air.Search.Tests\bin\Debug\WorldVentures.Fortius.Search.Tests.dll
File not found: C:\AirSearchBnd\src\Fortius.Air.Search.Tests\bin\Debug\WorldVentures.Fortius.Search.Tests.dll

Test Run Summary
  Overall result: Failed
  Test Count: 0, Passed: 0, Failed: 0, Inconclusive: 0, Skipped: 0
  Start time: 2017-01-27 03:35:50Z
    End time: 2017-01-27 03:35:50Z
    Duration: 0.025 seconds

Results (nunit3) saved as TestResult.xml
Committing...
No results, this could be for a number of reasons. The most common reasons are:
    1) missing PDBs for the assemblies that match the filter please review the
    output file and refer to the Usage guide (Usage.rtf) about filters.
    2) the profiler may not be registered correctly, please refer to the Usage
    guide and the -register switch.

C:\AirSearchBnd>exit 0 

Windows Batch命令 enter image description here

SonarQube扫描仪开始分析

enter image description here

SonarQube代码覆盖屏幕

enter image description here

2 个答案:

答案 0 :(得分:1)

尝试在MSBuild命令之后但在End Analysis之前执行OpenCover命令,如下所述: Code Coverage Results

答案 1 :(得分:1)

运行OpenCover时,WorldVentures.Fortius.Search.Tests.dll似乎不存在,由OpenCover输出判断。在Jenkins作业中,OpenCover批处理脚本在MSBuild步骤之前运行。如果单元测试是由MSBuild步骤构建的,则需要在OpenCover批处理脚本步骤之前执行。