volume_mute
TDD and Multithreaded Programs
publish date: 2026/06/19 10:09:33.831821 UTC
volume_mute
TDD has a significant limitation when applied to multithreaded programs. What is this limitation?
Correct Answer
Tests for multithreaded programs are inherently non-deterministic because thread scheduling can vary, making defects difficult to reproduce consistently
Explanation
TDD is difficult to apply to multithreaded programs because tests may be non-deterministic - the behavior depends on how threads are scheduled, which can vary between runs. Defects may appear and disappear depending on thread interleaving, making it hard to write tests that reliably expose these defects and confirm they are fixed.
Reference
Software Engineering, Ian Sommerville, 10th edition
