Skip to content
This repository has been archived by the owner on Nov 15, 2021. It is now read-only.

Merging Reports after the run #827

Closed
6 of 24 tasks
corentinaltepe opened this issue Jul 16, 2018 · 6 comments
Closed
6 of 24 tasks

Merging Reports after the run #827

corentinaltepe opened this issue Jul 16, 2018 · 6 comments

Comments

@corentinaltepe
Copy link

corentinaltepe commented Jul 16, 2018

My Framework

  • .NET 2
  • .NET 3.5
  • .NET 4
  • .NET 4.5
  • .NET 4.6
  • .NET 4.6.1
  • .NET 4.6.2
  • .NET Core 1.0.0
  • Something else

My Environment

  • Windows 7 or below (not truly supported due to EOL)
  • Windows 8
  • Windows 8.1
  • Windows 10
  • Windows 10 IoT Core
  • Windows Server 2012
  • Windows Server 2012 R2
  • Windows Server 2016

I have already...

  • repeated the problem using the latest stable release of OpenCover.
  • reviewed the usage guide and usage document.
  • have looked at the opencover output xml file in an attempt to resolve the issue.
  • reviewed the current issues to check that the issue isn't already known.

My issue is related to (check only those which apply):

  • no coverage being recorded
  • 32 or 64 bit support
  • feature request

Problem
I have a need to merge OpenCover's output reports AFTER running tests coverage analysis separately. The reason behind this is I have a list of unit tests and a list of integration tests. I run coverage for each separately, generate reports, then I combine both reports for a global coverage. I use ReportGenerator to generate the reports, and it merges OpenCover reports well. However, Jenkins doesn't have an OpenCover plugin to nicely integrate the coverage reports, so I publish the ReportGenerator HTML reports into Jenkins.

I also use an OpenCover-to-Cobertura converter, and then use Jenkins' Cobertura plugin to pulish the results in a nice format in Jenkins, but that works for only 1 report (either Units Tests list or Integration Tests).
I would like to merge the Unit Tests and Integration Tests results of OpenCover, to then convert it to Cobertura for an easy publishing to Jenkins. I have looked at merging Cobertura reports as an alternative but without luck.

Implementation
Looking at OpenCover XML report structure, it should be quite easy to do :
1 . Copy/Paste the Modules lists from each report to the merged report.
2. Compute the Summary of each report, and this is where there is a bit of business logic to implement and will need maintenance later on. From my understanding :

  • numSequencePoints, visitedSequencePoints, numBranchPoints, visitedBranchPoints, visitedClasses, numClasses, visitedMethods, numMethods are simply sums of each report's Summary respective attributes
  • maxCyclomaticComplexity and minCyclomaticComplexity are the min/max of all reports
  • sequenceCoverage, branchCoverage are trickier, would you explain how I can compute them properly ?
  • Am I forgetting something ?

Question
Do you think a merging feature would have its place in OpenCover ? I would see it as a command line verb action such as : opencover merge -source:unit.tests.xml,integration.tests.xml -output:global.xml

I personnally believe such feature should be part of OpenCover's core, and not as a peripheral tool, because it's code should evolve with the core's business logic (if, for example, the sequence and brancheCoverage computation rules evolve or new ones are added).

Would you accept such pull request ?

@danielpalme
Copy link
Contributor

danielpalme commented Aug 4, 2018

You could also use the latest ReportGenerator release:
https://www.nuget.org/packages/ReportGenerator/4.0.0-rc4

It supports Cobertura as an output format.
Just use the following command line parameters:
ReportGenerator.exe -targetdir:TODO -reports:TODO -reporttypes:HTML;Cobertura ...

ReportGenerator merges the coverage reports and generates a Cobertura file, which you can use for Jenkins.

OpenCover also has a -mergeoutput parameter. Maybe this helps (I have not yet used it myself):
https://github.com/OpenCover/opencover/wiki/Usage

@mridulnahar
Copy link

OpenCover also has a -mergeoutput parameter. i tried this option to merge coverage report but it doesn't work. please guide me if there is any solution available to merge reports.
https://github.com/OpenCover/opencover/wiki/Usage

@sawilde
Copy link
Member

sawilde commented Jan 1, 2019

@corentinaltepe yes but it would need to be supported with plenty of tests

@sawilde sawilde added the medium label Jan 1, 2019
@sawilde sawilde added this to To do in OpenCover - Future Jan 6, 2019
@VishalKulkarni0787
Copy link

Hi, my solution has 80, UT assemblies, 160 Integration test assemblies.
I each of these individually these to cover 100 production assemblies.
So for each assembly execution i get a coverage session report. Each report being approx 250 MB.
Totally now i have 40GB of files
Now i want to merge these reports to get overall coverage.
I have not tried loading all these files together to ReportGenerator, will it work?
But would be great if i could do it one by one, merging and enhancing report.
This way consolidation could be parallelised and made faster.

@danielpalme
Copy link
Contributor

@VishalKulkarni0787
ReportGenerator should be able to handle those files. Just give it a try.

@sawilde
Copy link
Member

sawilde commented Jan 2, 2021

I always use report generator I see no need for this feature

@sawilde sawilde closed this as completed Jan 2, 2021
OpenCover - Future automation moved this from To do to Done Jan 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Development

No branches or pull requests

5 participants