将InspectCode(Resharper)和OpenCover代码覆盖率报告合并到Sonar Qube Build中



我们使用InspectCode-Resharper插件生成C#代码分析报告和Opencover代码覆盖率报告(单元测试用例(。

这是在团队城市中一个接一个地运行的两个命令。当我们生成Resharper分析报告并推送到声纳量子时,我们会丢失代码覆盖率报告。

问题是如何将两个命令合并

到一个脚本中或合并两个命令的输出。

这些是我们执行的命令。

打开封面命令:

F:BuildSystemDependenciesSonarOpenCover4.5.3522OpenCover.Console.exe -register:user -target:F:BuildSystemDependenciesNUnitnunit-console-x86.exe -targetargs:"F:BuildsSonarHelix_Sonar_EsdPaymentsBpayUnitTestsbinDebugDummyProject.UnitTests.dll /noshadow" -excludebyattribute:"*.ExcludeFromCodeCoverage*|*.GeneratedCode*" -filter:"+[DummyProject*]* +[App.*]* -[*Tests*]*" -hideskipped:All -mergebyhash -output:coverage-report.xml

检查代码通信

D:sonarMSBuild.SonarQube.Runner-1.0MSBuild.SonarQube.Runner.exe begin /k:"dummy_project" /n:"dummy_project" /v:"sonarqube_project_version" /d:sonar.resharper.cs.reportPath="c:resharper.xml" /d:sonar.resharper.solutionFile="dummyproject.sln"
"C:Program Files (x86)MSBuild14.0Binmsbuild" "D:CommSee2010NeonwwwrootAppsdummyprojectdevdummyproject.sln"
"d:sonarjetbrains-commandline-toolsinspectcode.exe" /output="c:resharper.xml" "D:CommSee2010NeonwwwrootAppsdummyprojectdevdummyproject.sln"
 D:sonarMSBuild.SonarQube.Runner-1.0MSBuild.SonarQube.Runner.exe end

最终解决方案:

"D:sonarMSBuild.SonarQube.Runner-2.0MSBuild.SonarQube.Runner.exe" begin /k:"OFI.CS" /n:"OFI.CS" /v:"1" /d:sonar.cs.opencover.reportsPaths="D:sonaroutputofi.Report.opencover.xml" /d:sonar.cs.nunit.reportsPaths="D:sonaroutputTestResult.xml" /d:sonar.resharper.cs.reportPath="D:sonaroutputofi.Report.xml" /d:sonar.resharper.solutionFile="D:hxwwwrootappstestdevtest.sln" 
"C:Program Files (x86)MSBuild12.0BinMSBuild.exe" "D:hxwwwrootappstestdevtest.sln"
"C:Program Files (x86)OpenCoverOpenCover.Console.exe" -register:user -target:"C:Program Files (x86)NUnit 2.6.4binnunit-console-x86.exe" -targetargs:"D:hxwwwrootappstestdevUnitTestsbinDebugUnitTests.dll /noshadow /xml:D:sonaroutputTestResult.xml" -filter:"" -mergebyhash -output:"d:sonaroutputofi.Report.opencover.xml"
"D:sonarresharperinspectcode.exe" /output="D:sonaroutputofi.Report.xml" /profile="D:hxwwwrootappstestdevtest.sln.DotSettings" "D:hxwwwrootappstestdevtest.sln"
"D:sonarMSBuild.SonarQube.Runner-2.0MSBuild.SonarQube.Runner.exe" end

您需要将 OpenCover 输出文件上传到声纳,例如

/d:sonar.cs.opencover.reportsPaths="coverage-report.xml"

相关内容

  • 没有找到相关文章

最新更新