SteveGilham / altcover

Cross-platform coverage gathering and processing tool set for dotnet/.Net Framework and Mono
MIT License
494 stars 17 forks source link

How to combine different coverage files? #190

Closed 64J0 closed 11 months ago

64J0 commented 11 months ago

Description:

Hello, hope you're good.

I have some tests that run in parallel, and each is responsible for testing a module of the system. I'd like to combine all their coverage files (.xml) into a final single file.

Is it possible when using altcover? If it is, how?

SteveGilham commented 11 months ago

The Merge-OpenCover cmdlet can do this for you in a general case.

If the tests are being run on the exact same set of binaries, it is possible to do

  1. instrument once
  2. test 1
  3. collect
  4. test 2
  5. collect
  6. test 3
  7. collect
  8. ...
64J0 commented 11 months ago

They run in parallel in different virtual machines, but indeed, they are related to the same binaries. Thanks for the fast reply @SteveGilham.

64J0 commented 11 months ago

Possibly related: https://stackoverflow.com/questions/23089627/opencover-possible-to-merge-multiple-reports-into-one.

I'm going to start implementing/testing this tomorrow.

64J0 commented 11 months ago

I'm reopening this issue since I noticed that this tool documentation is for PowerShell. Does it work in Linux shell as well (like bash, for example)?

64J0 commented 11 months ago

Apparently PowerShell works on Linux -> https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-linux?view=powershell-7.3

64J0 commented 11 months ago

To present an overview of what I'm trying:

But, whenever I try to use the Merge-OpenCover command it throws this error:

Merge-OpenCover: The term 'Merge-OpenCover' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
64J0 commented 11 months ago

Actually, I understood how to use it now, after checking this file: