The coverage.dat
report should contain coverage information about all the classes affected by the --instrumentation_filter
. This file should be located under bazel-testlogs/path/to/your/package/TestTarget
.
You shouldn't have to write anything additional. Bazel does generate multiple temporary .dat
files, but it merges all of them in the final coverage.dat
file, whose location is printed by bazel when it finishes to run. That file is the one with the location I described above. Make sure to check that file and check if you're using --instrumentation_filter
(*) correctly.
(*) From the command line manual:
When coverage is enabled, only rules with names included by the
specified regex- based filter will be instrumented. Rules prefixed
with '-' are excluded instead. Note that only non-test rules are
instrumented unless -- instrument_test_targets is enabled.