Readplace

Mockists Are Dead. Long Live Classicists.

Thoughtworks 4 min read
View original
Summary (TL;DR)
A recent 'Is TDD Dead?' discussion with DHH, Martin Fowler, and Kent Beck criticized excessive mocking and stubbing in tests. Mocks become dangerous when used to isolate code from internal collaborators, causing false positives: tests pass even when code has bugs, method names are wrong, or interfaces change. The gurus argued that a 'unit' should be defined as a behavior, not necessarily a class or method. Tests should be shallow enough to verify one behavior, not mock everything. Over-mocking undermines confidence that tests actually catch breakage. Developers should reconsider their test design and mock only when truly needed.