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