我在按照http://docs.sonarqube.org/pages/viewpage.action?pageId=6389770上的说明使用Visual Studio代码覆盖率将问题导入到SonarQube 5.1.2时出现问题。我使用Git的样本Sonar项目。这是我的.bat文件:
MSBuild.SonarQube.Runner.exe begin /k:"UTTestCSharp" /n:"UTTestCSharp" /v:"1.0" /d:sonar.cs.vscoveragexml.reportsPaths="MyDir/VisualStudio.coveragexml"
msbuild /t:rebuild
"C:/Program Files (x86)/Microsoft Visual Studio 12.0/Team Tools/Dynamic Code Coverage Tools/CodeCoverage.exe" collect /output:"MyDir/VisualStudio.coverage"
"C:/Program Files (x86)/Microsoft Visual Studio 12.0/Common7/IDE/CommonExtensions/Microsoft/TestWindow/vstest.console.exe" "UnitTestProject1/bin/Debug/UnitTestProject1.dll"
"C:/Program Files (x86)/Microsoft Visual Studio 12.0/Team Tools/Dynamic Code Coverage Tools/CodeCoverage.exe" analyze /output:"MyDir/VisualStudio.coveragexml" "MyDir/VisualStudio.coverage"
MSBuild.SonarQube.Runner.exe end
此过程只会停留在生成VisualStudio.coverage
的部分,例如this picture。
如果我重新运行bat文件,那么该过程只是跳过生成部分并完成成功,但是Sonar Server上没有Coverage报告。我需要在Sonar仪表板上查看代码覆盖率报告。请帮忙。
答案 0 :(得分:1)
尝试使用此命令行。我在SonarQube doc页面中发现了拼写错误。 (对于VS2015)
"C:\SonarQube\sonar-scanner-msbuild-2.3.1.554\MSBuild.SonarQube.Runner.exe" begin /v:1.0 /k:UTTestCSharp /n:UTTestCSharp
"C:\SonarQube\sonar-scanner-msbuild-2.3.1.554\MSBuild.SonarQube.Runner.exe" begin /v:1.0 /k:UTTestCSharp /n:UTTestCSharp /d:sonar.cs.vscoveragexml.reportsPaths=".\VisualStudio.coveragexml"
"C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe" -p:Configuration=Release
"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Team Tools\Dynamic Code Coverage Tools\CodeCoverage.exe" collect /output:".\VisualStudio.coverage" "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe" /EnableCodeCoverage ".\bin\Release\UTTestCSharp.dll"
"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Team Tools\Dynamic Code Coverage Tools\CodeCoverage.exe" analyze /output:".\VisualStudio.coveragexml" ".\VisualStudio.coverage"
同时添加" Generic Coverage"插入。它与覆盖率报告有关。