Skip to content
All insights
EngineeringTesting5 min read

The mock that hides the bug

Mocks let your tests run fast and isolate units. They also let your tests pass while production breaks. The line is sharper than most teams treat it.

You mock the database. You mock the third-party API. You mock the time. Your unit tests are green, your CI is fast, your code is well-isolated. And then production breaks in a way the tests should have caught — because the mocks were lying.

When mocks lie

  • The mock returns success cases that the real service doesn't actually produce.
  • The mock skips edge cases (timeouts, retries, partial responses) that production hits.
  • The mock's interface drifts from the real one and tests don't notice.
  • The behavior under test only ever runs against the mock — never the real thing.

The honest mock

Verify against real services regularly — contract tests, integration tests, occasional end-to-end. Don't trust the mock alone for anything load-bearing. The mock is a tool for fast feedback, not a substitute for actually exercising the system.

A unit test that only ever runs against your mock is mostly testing your mock.

Most operations are behind where they could be.

Book a strategy call. We'll map one system worth automating in the next 30 days. No pitch, just the plan.