Azure DevOps:如何为不同的测试合并两个代码覆盖率报告(.net core,angular)
Azure DevOps: How to merge two code coverage reports for different tests (.net core, angular)
我们在管道中有两种不同类型的测试:单元(.net 核心)和前端(angular/karma)。他们每个人都可以通过 "PublishCodeCoverageResults@1" 发布代码覆盖率报告,但只有一个正面或背面。这取决于最后运行哪个测试。我认为最后的报道应该写在前面。但是我们需要同时发布代码覆盖率。
有没有办法合并 2 个覆盖率报告,然后将它们发布在一个代码覆盖率选项卡或添加第二个选项卡?
Is there way to merge 2 coverage report and then publish them in one Code Coverage tab or add the second tab?
据我所知,ReportGenerator 可以将多个覆盖率文件合并为一个,例如将多个 Cobertura XML 文件合并为一个 Cobertura XML 文件:
查看文档 ReportGenerator 了解更多详细信息。
您可以在 Azure devops 中执行以下步骤:
- Install the ReportGenerator extension: https://marketplace.visualstudio.com/items?itemName=Palmmedia.reportgenerator
- Configure the ReportGenerator task to produce HTML and Cobertura (this is the default)
- Configure the Publish code coverage results task and point it to the HTML files directory and the merged Cobertura file generated by
ReportGenerator
Currently the Publish code coverage results task regenerates the HTML
report. To avoid that, you have to create a new environment variable:
disable.coverage.autogenerate: 'true'
查看 this thread 了解更多详情。
希望这对您有所帮助。
我们在管道中有两种不同类型的测试:单元(.net 核心)和前端(angular/karma)。他们每个人都可以通过 "PublishCodeCoverageResults@1" 发布代码覆盖率报告,但只有一个正面或背面。这取决于最后运行哪个测试。我认为最后的报道应该写在前面。但是我们需要同时发布代码覆盖率。
有没有办法合并 2 个覆盖率报告,然后将它们发布在一个代码覆盖率选项卡或添加第二个选项卡?
Is there way to merge 2 coverage report and then publish them in one Code Coverage tab or add the second tab?
据我所知,ReportGenerator 可以将多个覆盖率文件合并为一个,例如将多个 Cobertura XML 文件合并为一个 Cobertura XML 文件:
查看文档 ReportGenerator 了解更多详细信息。
您可以在 Azure devops 中执行以下步骤:
- Install the ReportGenerator extension: https://marketplace.visualstudio.com/items?itemName=Palmmedia.reportgenerator
- Configure the ReportGenerator task to produce HTML and Cobertura (this is the default)
- Configure the Publish code coverage results task and point it to the HTML files directory and the merged Cobertura file generated by ReportGenerator
Currently the Publish code coverage results task regenerates the HTML report. To avoid that, you have to create a new environment variable: disable.coverage.autogenerate: 'true'
查看 this thread 了解更多详情。
希望这对您有所帮助。