volume_mute
TDD and Code Coverage
publish date: 2026/06/18 05:45:5.795482 UTC
volume_mute
One of the benefits of TDD is that it leads to high code coverage. Why does TDD help achieve comprehensive code coverage?
Correct Answer
Every code increment written in TDD has at least one associated test, so all code that is added is tested
Explanation
TDD leads to high code coverage because every piece of code is written to make a specific failing test pass. Every code increment has at least one associated test. In principle, all code that is added to a system is exercised by at least one test - which is a much stronger coverage guarantee than writing tests after the code.
Reference
Software Engineering, Ian Sommerville, 10th edition
