Q: I run tests on many machines and merging the clover.db files is very slow. Do I have to merge them?
Usually not. If the same application binaries are executed independently
on many machines, there is no need to merge databases at all. The Clover database
(clover.db) holds only the structure of your source code, while the
coverage itself lives in separate coverage recording files
(clover.dbxxxxxxxx_xxxxx_xxxx). Because the binaries are identical, the databases are
identical too, and merging them is wasted work.
Instead, copy all coverage recording files produced on all machines into one directory, together
with a single clover.db, and generate the report from there. See
What is the coverage.db file? and
Working with Distributed
Applications.
When you do need to merge
Merging with CloverMerge or <clover-merge> is required when you want to combine coverage for different applications or modules - i.e. genuinely different databases - into a single report.
A merged database is read-only. It can be used for reporting, but not for gathering further coverage. Attempting to run an instrumented application against it fails with "This database can only be used for reporting because it is the result of a merge". See Can't measure coverage using merged database.
If you need one database at runtime across several modules, create it during
instrumentation instead of merging afterwards: use the
<singleCloverDatabase> parameter in Maven, or set up Clover in the master
build file with inheritrefs="true" in Ant.