我们在管道中有两种不同类型的测试:unit(.net core)和前端(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?
AFAIK,ReportGenerator可以将多个coverage文件合并为一个文件,例如将多个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了解更多详细信息。
希望这可以帮助。
关于unit-testing - Azure DevOps : How to merge two code coverage reports for different tests (.网络核心,角度),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58166088/