~/talk

Coroutines + Testing = ❤️

Talkat droidCon Berlin 2019 · 2019-07-01..07-03· [testing, java, android]
slides:none on file

Explains the design of kotlinx-coroutines-test and how to write deterministic coroutine tests using Room, LiveData builder and Retrofit fakes; shows using runBlockingTest, TestCoroutineDispatcher/TestCoroutineScope and Dispatchers.setMain to advance virtual time (2s delays, 100ms await timeout) so tests never flake. Demonstrates mock vs fake tradeoffs, a failing timeout case fixed with supervisorScope and finally emitting null, and a known bug when switching to another dispatcher with a workaround via dependency injection. Tests and sample code are runnable but the library remains experimental.

AI-written summary · about

  1. 0:00Introduction to coroutines
  2. 6:52Testing coroutines with Room
  3. 22:33Testing ViewModel with coroutines
  4. 28:08Testing LiveData builder
  5. 33:16Testing multiple coroutines
  6. 40:54Library design of runBlockingTest
  7. 45:05Q&A and summary
~/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.