Reportgenerator: Bug in conversion from format Cobertura to Html for partial classes

Created on 5 Nov 2019  路  3Comments  路  Source: danielpalme/ReportGenerator

There is issue when we convert Cobertura XML to HTML
When we generate report for partial classes Generator merges all coverage to the first part of partial classes.

bug

Most helpful comment

Thanks for providing a minimal sample. Now I have understood the problem.

It's already fixed. A new release (4.3.6) should be available within the next 30 minutes.

All 3 comments

That's the intended behavior.
Coverage is grouped by class and not by file.
Therefore a partial class is handled as a single element and shows all corresponding files.

I prepared simple test solution which will show difference between code coverage in html format after conversion from Cobertura and OpenCover formats.
TestCoveragePartialClasses.zip

The Coverage.zip contains:
Coverage.zip

  • UnitTests.xmlCobertura.UnitTests.TestCoveragePartialClasses.results.xml - coverage created by dotnet with options dotnet test TestCoveragePartialClasses.sln --no-build /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura

  • UnitTests.xmlOpenCover.UnitTests.TestCoveragePartialClasses.results.xml - coverage created by dotnet with options dotnet test TestCoveragePartialClasses.sln --no-build /p:CollectCoverage=true /p:CoverletOutputFormat=opencover

    • folder cobertura.html - report converted from Cobertura.UnitTests.TestCoveragePartialClasses.results.xml by ReportGenerator.exe with option -reporttypes:Html

    • folder opencover.html -report converted from OpenCover.UnitTests.TestCoveragePartialClasses.results.xml by ReportGenerator.exe with option -reporttypes:Html

As you can see the Html report converted from OpenCover.UnitTests.TestCoveragePartialClasses.results.xml contains valid coverage
image

While the Html report converted from Cobertura.UnitTests.TestCoveragePartialClasses.results.xml contains merged coverage(which is invalid):
image

Thanks for providing a minimal sample. Now I have understood the problem.

It's already fixed. A new release (4.3.6) should be available within the next 30 minutes.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

daniel-white picture daniel-white  路  3Comments

ankit-arora12 picture ankit-arora12  路  7Comments

eduherminio picture eduherminio  路  5Comments

hannahchan picture hannahchan  路  3Comments

jpedretti-ciandt picture jpedretti-ciandt  路  3Comments