我无法在项目的信息中心上看到单元测试覆盖率信息。 我使用"单元测试覆盖率"小部件。
我搜索了Sonar文档并检查了stackoverflow上的其他问题 - 但遗憾的是没有找到任何帮助我处理问题的内容。
我有一个.sln文件,其中包含一些C#项目。
我正在使用MSBuildSonarRunner来分析sln并导入到SonarQube 5.1.2。
一切都是通过命令提示完成的,尽管我计划很快与TFS 2013集成。
我正在运行SonarQube文档链接中的详细命令,在#34; Visual Studio代码覆盖率"部分。
http://docs.sonarqube.org/display/PLUG/C%23+Code+Coverage+Results+Import
我使用VS2015"
的" MSBuild命令提示符特别是对于我的项目,这些命令是
cd C:\SONARTrial\Solutions
"C:\SONAR\sonar-runner-msbuild\MSBuild.SonarQube.Runner.exe" begin /name:SonarTest /key:SonarTestKey /version:1.0 /d:sonar.cs.vstest.reportsPaths="C:\SonarTrial\Solutions\TestResults\*.trx" /d:sonar.cs.vscoveragexml.reportsPaths="C:\SonarTrial\Solutions\CoverageResults\*.coveragexml"
msbuild soptrial.sln
"C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe" /Logger:trx "proj1.Tests\bin\Debug\proj1.Tests.dll"
"C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe" /Logger:trx "proj2.Tests\bin\Debug\proj2.Tests.dll"
"C:\Program Files (x86)\Microsoft Visual Studio 12.0\Team Tools\Dynamic Code Coverage Tools\CodeCoverage.exe" collect /output:"CoverageResults\proj1.coverage" "C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe" "proj1.Tests\bin\Debug\proj1.Tests.dll"
"C:\Program Files (x86)\Microsoft Visual Studio 12.0\Team Tools\Dynamic Code Coverage Tools\CodeCoverage.exe" analyze /output:"CoverageResults\proj1.coveragexml" "CoverageResults\proj1.coverage"
"C:\Program Files (x86)\Microsoft Visual Studio 12.0\Team Tools\Dynamic Code Coverage Tools\CodeCoverage.exe" collect /output:"CoverageResults\proj2.coverage" "C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe" "proj2.Tests\bin\Debug\proj2.Tests.dll"
"C:\Program Files (x86)\Microsoft Visual Studio 12.0\Team Tools\Dynamic Code Coverage Tools\CodeCoverage.exe" analyze /output:"CoverageResults\proj2.coveragexml" "CoverageResults\proj2.coverage"
"C:\SONAR\sonar-runner-msbuild\MSBuild.SonarQube.Runner.exe" end > a.txt
我确认文件存在于文件夹中。
以下2个陈述出现在输出文件" a.txt"对于我的sln中的每个项目(即由msbuild结束输出)
17:08:55.999 INFO - Parsing the Visual Studio coverage XML report C:\SonarTrial\Solutions\CoverageResults\proj1.coveragexml
17:08:56.161 INFO - Parsing the Visual Studio coverage XML report C:\SonarTrial\Solutions\CoverageResults\proj2.coveragexml
此外,在" a.txt"的末尾,它有以下几行
17:09:49.175 INFO - Sensor org.sonar.plugins.csharp.CSharpCodeCoverageProvider$CSharpCoverageReportImportSensor@d3b82e4
17:09:49.175 INFO - Parsing the Visual Studio coverage XML report C:\SonarTrial\Solutions\CoverageResults\proj1.coveragexml
17:09:49.195 INFO - Parsing the Visual Studio coverage XML report C:\SonarTrial\Solutions\CoverageResults\proj1.coveragexml
17:09:49.305 INFO - Sensor org.sonar.plugins.csharp.CSharpCodeCoverageProvider$CSharpCoverageReportImportSensor@d3b82e4 (done) | time=130ms
17:09:49.305 INFO - Sensor org.sonar.plugins.csharp.CSharpUnitTestResultsProvider$CSharpUnitTestResultsImportSensor@6ee3fc35
17:09:49.305 INFO - Parsing the Visual Studio Test Results file C:\SonarTrial\Solutions\TestResults\a_b 2015-09-30 17_08_28.trx
17:09:49.305 INFO - Parsing the Visual Studio Test Results file C:\SonarTrial\Solutions\TestResults\a_b 2015-09-30 17_08_29.trx
17:09:49.325 INFO - Sensor org.sonar.plugins.csharp.CSharpUnitTestResultsProvider$CSharpUnitTestResultsImportSensor@6ee3fc35 (done) | time=20ms
看起来跑步者能够找到文件,但解析它们不会产生任何覆盖结果显示在仪表板上......
单位测试计数显示在仪表板上,但覆盖范围为空白..
帮助!!!