What does "mock" mean in programming?
mock is one of the most common terms in software development. This guide explains what it means, how it is used in practice, and why it matters, with real examples from the developer world.
Definition of mock
A fake object used in tests to replace a real dependency. Mocks let you test a component in isolation, control what the dependency returns, and verify how the component interacts with it.
Example using mock
"Mock the external API to avoid real network calls."
mock Word Forms
| Form | Type | Meaning | Example |
|---|---|---|---|
| mock | noun | A fake object used in tests to replace a real dependency | "Mock the email service so tests stay isolated." |
| mock | verb (infinitive) | To replace a real dependency with a fake one in tests | "Mock the payment API to avoid real card charges." |
| mocked | past tense | Already replaced with a fake object for testing | "Mocked database calls keep tests fast and isolated." |
| mocking | gerund | The act of replacing real dependencies with fakes in tests | "Mocking external services keeps unit tests fast and predictable." |
Can you use "mock" correctly in a real dev context?
Turn vocabulary into real practice
Lingua-e turns words like this into full practice: fill the gap, listen and repeat, and real developer conversations. Free.
Practice for free →No credit card needed
when two branches edit the same lines
The build failedbecause of a missing dependency.
What do you say when you're blocked?