They Aren't All Mocks
Blog post from Speedscale
The series distinguishes five test-double roles based on behavior rather than mocking-library terminology: stubs provide predetermined answers, spies record side effects for later assertions, fakes are lightweight working implementations with state, dummies merely satisfy unused parameters, and mocks contain expectations that fail tests themselves. It introduces an in-memory recorder fake for a package notifier, allowing tests to verify that repeated notification attempts send only one delayed-package message because later calls can observe state written by earlier ones. The discussion argues that fakes are appropriate when interactions depend on prior writes, while canned stubs cannot model changing state, and cautions that fakes must preserve important production behavior such as retaining the first recorded message. It also contrasts spies, where tests interpret recorded calls, with mocks, which enforce behavioral expectations internally, recommending mocks sparingly for simple collaborators. Although the fake verifies application-level idempotency, it does not reproduce database constraints, transactions, concurrency, or HTTP behavior, which require other forms of testing.
No tracked trend matches for this post yet.
Use this post, company, and trend context to find content marketing opportunities, perform competitive analysis, or address product feature gaps via the Plushcap MCP server or the Plushcap API.