volume_mute
Benefits of Writing Tests First
publish date: 2026/06/04 11:00:2.633218 UTC
volume_mute
Writing tests before writing code has two important benefits. Which of the following correctly describes both?
Correct Answer
It implicitly defines both an interface and a specification of behaviour for the functionality being developed, reducing problems of requirements and interface misunderstandings; and it avoids test-lag where implementation gets further ahead of testing
Explanation
Writing tests first has two key benefits: (1) it implicitly defines an interface and a specification of behaviour for the functionality being developed — problems of requirements and interface misunderstandings are reduced; (2) it avoids test-lag — the situation where the developer works faster than the tester, the implementation gets further and further ahead of testing, and there is a tendency to skip tests to maintain the development schedule.
Reference
Software Engineering, Ian Sommerville, 9th edition
