What Mocks Are Actually For
Blog post from Speedscale
This ten-part series explains mocking as a way to give tests control over dependencies such as APIs, databases, clocks, queues, and services that are slow, unavailable, costly, non-deterministic, or unfinished. Using a package-notification example, it shows that a test cannot reliably cause a real carrier API to report a delayed shipment, whereas a stand-in can produce that condition on demand and verify the application’s resulting decision. The series emphasizes that mocks require a design seam where a dependency can be replaced and that they trade realism for control: a mocked test can prove behavior given a specified response but cannot validate the real service’s availability, protocol, configuration, or contract. It cautions against excessive mocking because stand-ins can preserve outdated assumptions while real integrations change, leaving tests green despite broken production behavior. Across examples in Java, Node.js, Go, and Python, the posts cover creating useful mocks, simulating failures, testing side effects with spies, avoiding brittle interaction-based tests, distinguishing types of test doubles, testing real clients against fake HTTP servers, detecting contract drift, and selecting appropriate fidelity as systems grow.
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.