Mocking replaces real dependencies with test doubles. Stubs return fixed values, spies record calls, fakes provide simplified implementations, and mocks verify interactions. Over-mocking makes tests brittle. Best practices: mock at boundaries (network, filesystem, clock), prefer fakes for complex dependencies, and use dependency injection.
The 5-Mode Loop
5 of 5 modes available
Read · See · Animate · Test · Build
Before this, understand: unit testing