Testing interview question · Most asked
Is 100% code coverage a good goal?
Summary
Not usually. Coverage shows which code was executed, not whether behavior was verified; chasing 100% leads to low-value tests of trivial code. Use coverage to find untested critical paths, and set a reasonable floor or a 'no decrease' rule.
Longer Answer
Branch coverage is more informative than line coverage; mutation testing (Stryker, PIT, mutmut, Infection) measures whether tests actually detect changes.
Key Points
- Executed ≠ verified
- Find gaps in critical code
- Branch over line coverage
- Mutation testing measures test quality