Rupak Das
Rupak Das

Reputation: 11

Does Merging multiple jacoco.exec file reduces merged file size and gives diffrent code Coverage percentage?

I am having having three jacoco.exec files. I am able to merge the files and get an output as a merged.exec file.

But my merged.exec file is smaller than combined file size. Eg. my file sizes :

1st jacoco.exec = 1789 KB = Code Coverage = 4% 
2nd jacoco.exec = 925 KB = Code Coverage = 3% 
3rd jacoco.exec = 510 KB = Code Coverage = 4% 
------------------------- 
Merged.exec = 625 KB = Code Coverage = 5%
========================================================================

Due to this I am getting different code Coverage percentage from my final output.

I am not understanding the calculation of the merged file and how come it is more. Please, explain the calculation behind the merge process.

Upvotes: 1

Views: 851

Answers (1)

DoctorLOL
DoctorLOL

Reputation: 93

If a jacoco.exec file is created with "append", it contains data from different sessions. If this file is merged, the data from different sessions are also merged. Therefore the resulting file has a smaller file size.

But the code coverage percentage of the merged file will always be equal or greater.

Related discussions : https://groups.google.com/forum/#!topic/jacoco/msl5rGuz1dw From marc (from jacoco)

indeed this can be correct. The exec files contain a execution data dump per session. When merging the execution data for every class is consolidated and written as single dump.

So if your exec filed contain multiple sessions, the merged version of thif file will be smaller. You can verify by looking into the exec files:

Upvotes: 1

Related Questions