volume_mute
TDD Core Process - Identify the Missing Step
publish date: 2026/06/19 10:51:10.994858 UTC
volume_mute
In TDD, a developer (1) identifies a small functionality increment, (2) writes an automated test, (3) runs the test and it fails, (4) implements the functionality, and (5) re-runs all tests. If all tests now pass, what is the sixth step?
Correct Answer
Refactor the code to improve its structure without breaking any tests
Explanation
After all tests pass in a TDD cycle, the developer refactors the code to improve its internal structure and clarity without changing its external behavior. The test suite serves as a safety net during refactoring - any regression introduced will immediately cause a test to fail. Refactoring keeps the codebase clean as it grows incrementally.
Reference
Software Engineering, Ian Sommerville, 10th edition
