I am currently working on implementing the code coverage package on our projects on DevOps. The basic functionality works, but I cannot get the coverage history graph or risk hotspots to show in DevOps.
The current steps are as follows:
Run edit mode tests, publish file to folder.
Convert the Unity OpenCover files to Cobertura with ReportGenerator tool. historydir input is set, and each run creates a new xml file. reports input is set to opencov/EditMode subfolder xml.
Coverage results is published with PublishCodeCoverageResults task.
I have run the pipeline around 20-30 times with different variations of parameters, and also with disable.coverage.autogenerate. This did not seem to work either, and also removed the styling for the coverage page.
Currently it looks something like this. Have also tried to add
generateHtmlReport;generateHtmlReportHistory and coverageHistoryPath to Unity arguments, but should not be needed as I understand it, as this is overriden by report generator anyway.
After 47 runs of the pipeline it worked! I set disable.coverage.autogenerate to true, generated HtmlInline_AzureDevops;Cobertura reports from ReportGenerator, and added the reportDirectory in PublishCodeCoverageResults task.
Hi @mwarvik - I am glad you resolved it! I wanted to add that currently for pathFilters only absolute paths are supported. However, you can use globbing to make them shorter e.g. **/Assets/Scripts/. We are exploring allowing relative paths in a future release.
As it is now, it works fine for our use case We just include everything in Packages folder by default (eg ‘+/Packages/’), with an optional parameter that can be sent in for special cases.