Index Ai Academy
Glossary · Phase 7 · Software engineering

Mock object

Also written: mock objects, mocks

A stand-in object for tests that records how it was called, so a test can replace an email sender or an API.

Try it now

Use the lightest tool that works. Most tests need no fakes at all; fakes are for the parts you can't control.

Learn it properly

Testing with pytest · Fixtures, parametrize, mocks, temporary files and coverage. About 45 minutes.

Create a free account See what's in the lesson

Other terms from the same lesson

Never trained an AI?

Teach a small one to write, right in your browser. It takes about 20 seconds and needs no account.

Teach it to write