The Magic Tricks of Testing
summary
Argues that unit testing follows a six-cell grid with precise rules: test incoming queries by asserting return values, test incoming commands by asserting direct public side effects, and ignore private methods plus outgoing queries to avoid over‑specification. For outgoing commands the rule is to set expectations on outgoing commands and use mocks so tests stay fast and stable; mentions Ruby/Rails tooling and use mocks (moxin). Presents these rules in 28 minutes and claims the approach yields fewer, cheaper-to-maintain tests.
AI-written summary · about
chapters (11)
- 0:00The state of testing
- 1:35Why tests are hated
- 3:20Principles of good tests
- 5:56Understanding message origins
- 7:44Queries vs commands
- 9:34Testing incoming messages
- 13:34Testing messages to self
- 15:50Testing outgoing queries
- 22:11Testing outgoing commands
- 23:21Using mocks safely
- 30:01Summary of testing magic








