What is a mock?

Talking about ‘Mocks’ or ‘Mocking’ in everyday conversation can be confusing if you are not part of the tech community. The word ‘mock’ in the english language is defined as such:

1) tease or laugh at in a scornful or contemptuous manner.

2) to ridicule by mimicry of action or speech; mimic derisively.

3) to mimic, imitate, or counterfeit.

People I speak with outside of the tech community identify with the first two definitions, but it’s the third that most programmers care about.

When testing applications it’s incredibly helpful to be able to ‘mock’ something out by ‘mimicking, imitating, or counterfeiting’ functions or features.

Mocking allows programmers to quickly built a fake copy of a real function, which they can poke and prod without fear of destroying, or even interacting the real thing.

Many languages have their own mocking setups, and my current language Python is no exception. Mocks in Python.