Merging Coverage DataΒΆ
You can merge coverage data from multiple runs with
-a/--add-tracefile
.
For each run, generate JSON output:
... # compile and run first test case
gcovr ... --json run-1.json
... # compile and run second test case
gcovr ... --json run-2.json
Next, merge the json files and generate the desired report:
gcovr --add-tracefile run-1.json --add-tracefile run-2.json --html-details coverage.html
You can also use unix style wildcards to merge the json files without
duplicating -a/--add-tracefile
. With this option
you have to place your pathnames with wildcards in double quotation marks:
gcovr --add-tracefile "run-*.json" --html-details coverage.html