A simulated object that mimics the behavior of real objects in controlled ways during testing. Mock objects have pre-programmed expectations and can verify that they were called correctly by the code under test.
From Middle English 'mokken' meaning to deride or imitate, first used in software testing by Tim Mackinnon, Steve Freeman, and Philip Craig in 2000. The term emphasizes the object's role as an imitator that 'mocks' or simulates real dependencies for testing purposes.
A mock object is like a stunt double in movies - it looks like the real actor (object) and can perform specific scripted actions, but it's completely controlled and safe for dangerous scenes (tests). Unlike real objects that might crash or be slow, mocks are predictable and fast, letting you test your code's behavior without external dependencies!
Complete word intelligence in one call. Free tier — 50 lookups/day.