Stop Using Mocks (for a while)
summary
The claim is blunt: stop using mocks for a while and instead build an adapter, inject it, and use a small in‑memory fake or integration tests. Concrete tools: an adapter class that hides requests, a fake cargo API backed by a dict, dependency injection instead of mock.patch, sandbox or a local fake container, and VCR.py for recordings. Before this change a feature spawns ~12 tests with 5–6 mocks each; after it yields Functional Core, Imperative Shell, clearer tests, Dependency Injection and hand-rolled fakes that actually work and reduce brittleness.
AI-written summary · about
chapters (10)
- 0:00Introduction
- 0:57The Heros Journey
- 4:11Example Code
- 8:40Sync to API
- 12:25Mocks are Broken
- 16:56Adapter Example
- 22:10Build a Fake
- 27:08Dependency Injection
- 33:32Wrapping Up
- 37:25Building a Fake API
related talks
25mFakes over Mocks: Shift your paradigm and identify monolithic code
52mPlease don’t mock me
37mBeyond the Mockery: Why We Should Embrace Testing Without Mocking Frameworks
31mBeyond the Mockery- Why We Should Embrace Testing Without Mocking Frameworks
39mIntro to Mocking: Why Unit Testing Doesn't Have To Be So Hard
49mFor those about to Mock I salute you!
27mDe-mock your tests
33mMock Me If You Can: Using Mocks in Container Applications for Integration Testing
