Is there anyway to merge cobertura coverage xml reports together?

jan-hybs picture jan-hybs · Oct 20, 2014 · Viewed 10.7k times · Source

I have c++/c application with a lots of unit tests. I would like to get overall coverage and also individual coverage of each test with condition that each test can be run only once. Format of coverage must be xml (cobertura xml) for jenkins cobertura plugin to process.

So far I generate gcno files upon compilation and gcda files when source is used. Then call gcovr to get xml file.

I would like to create coverage of each unit test (thus creating coverage xml for every unit test) and then merge these xml files into one xml file.

Thanks!

Answer

agua from mars picture agua from mars · Sep 19, 2018

The last release of ReportGenerator can merge cobertura files.

You can install it from nuget

usage:

reportgenerator "-reports:target\*\*.xml" "-targetdir:C:\report" -reporttypes:Cobertura

A file Corbertura.xml is generated in the targetdir directory

You can use the dotnet core version to use it on linux or mac