How to write a mock-free app
summary
Argues that avoiding Mockito/MockK yields simpler, more reliable tests by replacing interface+fake boilerplate with Kotlin features: use fun interfaces, typealiases and inline lambdas so ViewModels and Repositories receive callables instead of mocked classes. Shows examples with Retrofit for I/O and Coin for DI, explains test stubs become two-character lambdas, and claims these patterns run in production across an 80+ gradle-module codebase with apps downloaded over 3 million times, reducing boilerplate and flakiness.
AI-written summary · about
chapters (9)
- 0:00Introduction
- 2:08Mocks in testing problems
- 3:53Clean architecture patterns
- 7:06Elephant horse cat testing
- 9:16Testing with elephant
- 11:01Testing with horse
- 13:57Testing with cat
- 16:25Conclusion SOLID principles
- 17:29Android context in ViewModels
related talks
37mBeyond the Mockery: Why We Should Embrace Testing Without Mocking Frameworks
29mTesting in Practice: Keeping Your Tests Concise and Declarative
27mDe-mock your tests
31mBeyond the Mockery- Why We Should Embrace Testing Without Mocking Frameworks
30mRefactoring and Test Fakes: Crafting Resilient Code with Confidence
41mMocks vs Fakes vs Stubs
28mTesting Out Kotlin
32mTesting with Kotlin
