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!
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
The simplest utility I've found for merging Cobertura files is cobertura-merge
via NPM.
Usage:
npm install cobertura-merge cobertura -merge -o output.xml package1=input1.xml package2=input2.xml
Or it can be used directly without installing through npx
:
npx cobertura-merge -o output.xml package1=input1.xml package2=input2.xml
Examples sourced from the GitHub README for cobertura-merge
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With