Reputation: 293
We have two different types of tests in pipeline: unit(.net core) and frontend (angular/karma). Each of them can publish code coverage report via to "PublishCodeCoverageResults@1", but only one front or back. It depends on which test runs last. I think the last coverage owerwrites previous. However we need both code coverage publish.
Is there way to merge 2 coverage report and then publish them in one Code Coverage tab or add the second tab?
Upvotes: 12
Views: 9244
Reputation: 76760
Is there way to merge 2 coverage report and then publish them in one Code Coverage tab or add the second tab?
AFAIK, ReportGenerator can merge multiple coverage files into one, e.g. merge several Cobertura XML files into just one Cobertura XML file:
Check the document ReportGenerator for some more details.
You can do the following steps in the 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'
Check this thread for some more details.
Hope this helps.
Upvotes: 13