blob: f3c4ca935aad61e42f53683ddb66141ef5676f04 [file] [log] [blame] [view]
Yuke Liaoadeb49122019-07-22 21:08:241# Life of Increasing Code Coverage
2
3The goal of this doc is to provide guidance on how to write better tests using
4code coverage information rather than increase code coverage itself.
5
61. Pay attention to **untested** code in both the
Prakhar418fc0f2022-07-19 19:35:297[coverage dashboard](https://analysis.chromium.org/coverage/p/chromium) and
Yuke Liaoadeb49122019-07-22 21:08:248[code coverage in Gerrit](code_coverage_in_gerrit.md) during code review.
9
102. Is this dead code? If yes, draft a CL
11([example](https://chromium-review.googlesource.com/c/chromium/src/+/1550769))
12to remove it, otherwise, please go to step 3.
13
143. Think about why the code is not covered by any test. Is it because it's
15too complicated to be testable? If yes, draft a CL to refactor the code and add
16tests ([example](https://chromium-review.googlesource.com/c/chromium/src/+/1558233)),
17otherwise, please go to step 4.
18
194. If the code is testable, but a test was forgotten, draft a CL to add
20tests for it ([example](https://chromium-review.googlesource.com/c/chromium/src/+/1447030)).
21
22Anytime you upload a CL to refactor or add tests, you can use
23[code coverage in Gerrit](code_coverage_in_gerrit.md) to help you verify the
24previously untested code is now tested by your CL.
25
26Please refer to [code_coverage.md](code_coverage.md) for how code coverage works
27in Chromium in general.
28
29### Contacts
30
31For any breakage report and feature requests, please
32[file a bug](https://bugs.chromium.org/p/chromium/issues/entry?components=Infra%3ETest%3ECodeCoverage).
33
34For questions and general discussions, please join
35[code-coverage group](https://groups.google.com/a/chromium.org/forum/#!forum/code-coverage).