Reputation: 41
I am starting to work with bazel, My current aim is to implement code coverage with bazel. Could you please share any examples or documentation for the same?
Upvotes: 2
Views: 2827
Reputation: 8142
bazel coverage
will do the job. The coverage command line argument generates code coverage report for specified test targets
Example
bazel coverage -s \
--instrument_test_targets \
--experimental_cc_coverage \
--combined_report=lcov \
--coverage_report_generator=@bazel_tools//tools/test/CoverageOutputGenerator/java/com/google/devtools/coverageoutputgenerator:Main \
//...
HTML Output:
genhtml /home/vertexwahn/.cache/bazel/_bazel_vertexwahn/e74a825d0eb0c2db4b6f8afd819b274c/execroot/__main__/bazel-out/k8-fastbuild/testlogs/foo_test/coverage.dat --output-directory coverage
Upvotes: 1