Avoiding Mockageddon
summary
Argues that excessive mocking makes refactoring slow and tests brittle, notes real cases with 50 or 60 stubs/mocks in one test suite, and shows concrete techniques that work: use PHPUnit createStub/createMock for simple stubs and mocks, write a fake invoice repository for fast in-memory behavior, and employ test proxies to run real code while asserting interactions. Demonstrates that fakes and proxies simplify tests and that overmocking causes false confidence and maintenance pain.
AI-written summary · about
chapters (16)
- 0:00Introduction
- 2:15What are test doubles
- 4:00Test stubs
- 7:47Mock objects
- 11:55Excessive
- 13:53Disguising dependencies
- 17:36Test code
- 19:26Excessive use of marks
- 20:31Giving up on unit tests
- 21:50Immutable state
- 25:48Explicit dependencies
- 29:35Fake objects
- 32:40Testing
- 35:52Uncle Bob
- 37:13Test Proxy
- 43:30QA Session








