~/talk

Untangling Coroutine Testing

Talkat KotlinConf 2023 · 2023-04-12..04-14· Granbeurszaal· [testing, kotlin]
slides:none on file

Shows concrete results with kotlinx.coroutines 1.6 testing APIs: use runTest, create a single test scheduler shared by all test dispatchers, prefer StandardTestDispatcher (queues) over UnconfinedTestDispatcher (eager start) for real concurrency, and advance the scheduler or call advanceUntilIdle to make launches run. Demonstrates Dispatchers.setMain/resetMain and a JUnit rule, using backgroundScope to auto-cancel collectors, and explains why StateFlow-plus-stateIn needs a fake collector or explicit awaiting to observe updates.

AI-written summary · about

  1. 0:00Introduction
  2. 1:16Calling suspending functions
  3. 5:35Testing APIs
  4. 13:40Injecting Dispatchers
  5. 20:02Injecting Test Dispatchers
  6. 25:08Flows
  7. 31:45State flows
  8. 38:53Questions
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 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
?
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.