【问题标题】:Merge InspectCode (Resharper) and OpenCover code coverage report into Sonar Qube Build将 InspectCode (Resharper) 和 OpenCover 代码覆盖率报告合并到 Sonar Qube Build
【发布时间】:2016-05-28 16:34:53
【问题描述】:

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

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

问题是如何将两个命令合并到一个脚本或合并两个命令的输出。

这些是我们执行的命令。

OpenCover 命令:

F:\BuildSystem\Dependencies\Sonar\OpenCover\4.5.3522\OpenCover.Console.exe -register:user -target:F:\BuildSystem\Dependencies\NUnit\nunit-console-x86.exe -targetargs:"F:\Builds\Sonar\Helix_Sonar_EsdPaymentsBpay\UnitTests\bin\Debug\DummyProject.UnitTests.dll /noshadow" -excludebyattribute:"*.ExcludeFromCodeCoverage*|*.GeneratedCode*" -filter:"+[DummyProject*]* +[App.*]* -[*Tests*]*" -hideskipped:All -mergebyhash -output:coverage-report.xml

InspectCode 命令

D:\sonar\MSBuild.SonarQube.Runner-1.0\MSBuild.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)\MSBuild\14.0\Bin\msbuild" "D:\CommSee2010\Neon\wwwroot\Apps\dummyproject\dev\dummyproject.sln"

"d:\sonar\jetbrains-commandline-tools\inspectcode.exe" /output="c:\resharper.xml" "D:\CommSee2010\Neon\wwwroot\Apps\dummyproject\dev\dummyproject.sln"

 D:\sonar\MSBuild.SonarQube.Runner-1.0\MSBuild.SonarQube.Runner.exe end

最终解决方案:

"D:\sonar\MSBuild.SonarQube.Runner-2.0\MSBuild.SonarQube.Runner.exe" begin /k:"OFI.CS" /n:"OFI.CS" /v:"1" /d:sonar.cs.opencover.reportsPaths="D:\sonar\output\ofi.Report.opencover.xml" /d:sonar.cs.nunit.reportsPaths="D:\sonar\output\TestResult.xml" /d:sonar.resharper.cs.reportPath="D:\sonar\output\ofi.Report.xml" /d:sonar.resharper.solutionFile="D:\hx\wwwroot\apps\test\dev\test.sln" 

"C:\Program Files (x86)\MSBuild\12.0\Bin\MSBuild.exe" "D:\hx\wwwroot\apps\test\dev\test.sln"

"C:\Program Files (x86)\OpenCover\OpenCover.Console.exe" -register:user -target:"C:\Program Files (x86)\NUnit 2.6.4\bin\nunit-console-x86.exe" -targetargs:"D:\hx\wwwroot\apps\test\dev\UnitTests\bin\Debug\UnitTests.dll /noshadow /xml:D:\sonar\output\TestResult.xml" -filter:"" -mergebyhash -output:"d:\sonar\output\ofi.Report.opencover.xml"

"D:\sonar\resharper\inspectcode.exe" /output="D:\sonar\output\ofi.Report.xml" /profile="D:\hx\wwwroot\apps\test\dev\test.sln.DotSettings" "D:\hx\wwwroot\apps\test\dev\test.sln"

"D:\sonar\MSBuild.SonarQube.Runner-2.0\MSBuild.SonarQube.Runner.exe" end

【问题讨论】:

    标签: sonarqube teamcity resharper jetbrains-ide opencover


    【解决方案1】:

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

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

    【讨论】:

    • 注意:您的 OpenCover (4.5.3522) 已经很旧了
    猜你喜欢
    • 2013-03-28
    • 1970-01-01
    • 2016-03-06
    • 2017-03-17
    • 2018-09-02
    • 2012-06-11
    • 1970-01-01
    • 2012-11-27
    • 2012-06-30
    相关资源
    最近更新 更多