~/talk

Unit Testing Kotlin Channels & Flows

Talkat droidcon Americas 2020 · 2020-11-16..11-17· [testing]
speakerdeck:heyitsmohit
slides:none on file

Practical guide to unit testing Kotlin coroutines shows exact recipes: use runBlockingTest with a TestCoroutineDispatcher, inject dispatchers and call advanceTimeBy(1000) to move past one‑second delays, prefer the Turbine library to assert item, error, and completion events and catch unconsumed emissions, wrap exceptions with Result in a catch operator to emit failures, test retries that delay before reattempts, and watch for rendezvous channels that leave a suspended coroutine active so tests fail unless cleaned up.

AI-written summary · about

  1. 0:00Introduction to testing
  2. 1:59Simple flow testing setup
  3. 5:59Improving tests with Turbine
  4. 12:42Testing errors in flows
  5. 16:37Handling delays in tests
  6. 23:43Testing view model flows
  7. 28:41Common testing problems
  8. 32:11Library testing patterns
  9. 35:46Resources and conclusion
~/search
type to search 8,222 conferences, 162,397 speakers and 219,688 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
← →
on a talk: 5 seconds back / forward
0–9
on a talk: jump to 0%–90% of the recording
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.