Few Tools: How To Write And Understand! Coroutines Tests
summary
Claim: using the Kotlin coroutines APIs plus a little discipline makes coroutine tests far more readable and reliable. Demonstrations include a biometrics presenter, fake collaborators, channels and turbines (including a new channel-based turbine/turbine 0.9), runTest/runCurrent, timeouts, and molecule + Jetpack Compose wiring. Dangers shown: conceptual vs real race conditions, silent use of Dispatchers.Default, and why to inject CoroutineContext and prefer structured concurrency. Builds and tests mostly work but require the specific idioms shown.
AI-written summary · about
chapters (9)
- 0:00Introduction and setup
- 3:05Basic testing with turbine
- 7:56Conceptual vs. real races
- 12:36Using channels for control
- 17:01Addressing output races
- 22:21Testing for empty results
- 26:32Dispatcher pitfalls
- 32:43Structured concurrency
- 37:43Summary and Q&A



