Fake the Ktor Client & Repos
Use MockEngine and fakes for deterministic tests.
Tests Should Not Hit the Network
Real HTTP calls are slow and flaky in tests. Instead you fake the response so each run is fast and deterministic. 🎯
Ktor Ships a MockEngine
Ktor includes a built-in MockEngine that returns canned responses instead of making real requests.
All lessons in this course
- kotlin.test in commonTest
- Test suspend Functions & Flows
- Fake the Ktor Client & Repos
- Run Tests on Android & iOS Targets