如何将 Azure 管道测试结果发布到 SonarCloud
How to publish azure pipeline test result to SonarCloud
我需要将我的测试覆盖率结果发布到 SonarCloud。我目前的管道是这个
更新:- 在 运行 代码分析步骤中可以找到此日志。但是在SonarCloud中覆盖结果不显示。
INFO: Parsing the Visual Studio coverage XML report D:\a\.\TestResults\VssAdministrator_fv-az185_2019-11-13_11_15_46\In\fv-az185\VssAdministrator_fv-az185 2019-11-13 11_15_34.coveragexml
INFO: Adding this code coverage report to the cache for later reuse: D:\a\.\TestResults\VssAdministrator_fv-az185_2019-11-13_11_15_46\In\fv-az185\VssAdministrator_fv-az185 2019-11-13 11_15_34.coveragexml
INFO: Coverage Report Statistics: 21 files, 20 main files, 20 main files with coverage, 1 test files, 0 project excluded files, 0 other language files.
How to publish azure pipeline test result to SonarCloud
根据文档:
From Team Foundation Server 2015 or Visual Studio Team Services
- Optional: To import code coverage into SonarQube, add the Visual Studio Test build task after the build one and tick Code Coverage
Enabled
因此,请确保您已在 VsTest 任务中选中启用代码覆盖率。
此外,如果你已经勾选了那个选项,你可以检查一下你的SonarQube版本是不是6.5,那个版本有问题:
SonarQube 6.5 – Code Coverage Result is not displayed
而且,如果您可以在 Azure devops 而不是在 SonarCloud 中获得代码覆盖率,请检查 this thread 是否提供任何帮助。
希望对您有所帮助。
发布测试结果的完整指南
我需要将我的测试覆盖率结果发布到 SonarCloud。我目前的管道是这个
更新:- 在 运行 代码分析步骤中可以找到此日志。但是在SonarCloud中覆盖结果不显示。
INFO: Parsing the Visual Studio coverage XML report D:\a\.\TestResults\VssAdministrator_fv-az185_2019-11-13_11_15_46\In\fv-az185\VssAdministrator_fv-az185 2019-11-13 11_15_34.coveragexml
INFO: Adding this code coverage report to the cache for later reuse: D:\a\.\TestResults\VssAdministrator_fv-az185_2019-11-13_11_15_46\In\fv-az185\VssAdministrator_fv-az185 2019-11-13 11_15_34.coveragexml
INFO: Coverage Report Statistics: 21 files, 20 main files, 20 main files with coverage, 1 test files, 0 project excluded files, 0 other language files.
How to publish azure pipeline test result to SonarCloud
根据文档:
From Team Foundation Server 2015 or Visual Studio Team Services
- Optional: To import code coverage into SonarQube, add the Visual Studio Test build task after the build one and tick Code Coverage Enabled
因此,请确保您已在 VsTest 任务中选中启用代码覆盖率。
此外,如果你已经勾选了那个选项,你可以检查一下你的SonarQube版本是不是6.5,那个版本有问题:
SonarQube 6.5 – Code Coverage Result is not displayed
而且,如果您可以在 Azure devops 而不是在 SonarCloud 中获得代码覆盖率,请检查 this thread 是否提供任何帮助。
希望对您有所帮助。
发布测试结果的完整指南