~/talk

Testing with Coroutines

Talkat KotlinConf 2019 · 2019-12-04..12-06· [testing, kotlin]
slides:none on file

Shows how kotlinx.coroutines.test makes coroutine tests deterministic by giving runBlockingTest virtual time control and thread blocking so timeouts can be asserted with advanceTimeBy and completableDeferred fakes, explains injecting TestCoroutineScope/TestCoroutineDispatcher so launched coroutines don’t leak, shows Android helpers setMain/resetMain, and demonstrates flow testing patterns (take, collecting in a launched job then cancel). Examples run and the techniques reliably reproduce and assert timing and concurrency behavior.

AI-written summary · about

  1. 0:00Start
  2. 0:45Disclaimer
  3. 1:12Test a Timeout That Is Implemented Using Co-Routines
  4. 3:23Fake Api
  5. 3:43Parameter Injection
  6. 4:18Test the Timeout
  7. 4:55Completable Deferred
  8. 8:25Sequence Diagram
  9. 12:49Run Blocking Test
  10. 19:00Diving into Event Loops
  11. 19:38Event Loop
  12. 20:46Timeout Test
  13. 21:07Delay Fake Api
  14. 23:17When To Use this Library versus Other Ways To Write Tests
  15. 27:33Testing Flow
  16. 31:16Infinite Loop
~/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.