Explain it in 60 seconds
Mocks, stubs and spies
Frontend Engineering · Testing and Tooling · Beginner
What are mocks, stubs and spies in testing?
What a strong answer covers
Your AI report card counts how many of these ideas you cover.
- Replace real dependencies in tests.
- Stub: returns fixed data.
- Spy: records calls.
- Mock: fake with expectations.
- Avoid over-mocking.
Practise this topic
Start without signing up. Sign in free to get an AI report card on your answer.