Testing Kotlin Coroutines
summary
Shows concrete patterns for Android and backend: convert blocking calls by adding suspend and wrapping callbacks with suspendCancellableCoroutine, offload blocking work with withContext(Dispatchers.IO) (default IO pool 64 threads), create scopes with SupervisorJob and exception handlers, limit concurrency with flow flatMapMerge, use supervisorScope vs coroutineScope for failure isolation. Tests use runTest virtual time so delays advance instantly and allow precise assertions that parallel async halves runtime and sequential doubles it.
AI-written summary · about
chapters (15)
- 0:00Introduction
- 9:50Practical use cases
- 11:20Migrating to Coroutines
- 13:10Application Layers
- 14:05Data Layer
- 17:40Dispatchers IO
- 20:35Dispatchers Default
- 22:00Domain Layer
- 26:10Exceptions in async
- 27:35Timeout
- 28:00Presentation Layer
- 30:10Scope
- 34:10Exception Handler
- 36:05Testing
- 41:17Conclusion
related talks
42mKotlin Coroutines: An Intro to Practical Use on Android
38mKotlin coroutines
49mLaunching Into Coroutines
40mBuilding Asynchronous Mechanisms in Android App, Using Kotlin Coroutines
40mConcurrency made easy with Kotlin Coroutines
33mTesting with Coroutines
47mKotlin Coroutines
43mCoroutines for Java Developers
