Chapter 2 · Practice 4 of 6
Review the tests and ask whether they would fail if the code broke
Why it matters
Changes should usually come with tests in the same change: unit, integration or end-to-end, as appropriate. But the existence of tests is not enough.
Google's guide asks reviewers to check whether the tests are correct, sensible and useful, and frames the key question as: will the tests actually fail when the code is broken?
Look for:
- Tests with no meaningful assertions
- Assertions that check something trivial instead of the behaviour that changed
- Missing cases for the edge conditions you spotted when reviewing the code
- Tests so complex they need their own tests
Remember that tests are code that has to be maintained too. Do not accept complexity in tests just because they are not production code.