Testing·Advanced·Conceptual·1 min read
Why might a test intentionally use a fake instead of a mock for a database?
Short interview answer
A fake, such as an in-memory implementation of the same interface, lets integration-style tests exercise realistic query and transaction behavior without asserting on specific call arguments the way a strict mock would.
Key takeaway
Explain the underlying mental model clearly, then support it with a concrete example and its trade-offs.