~/talk

Effective Unit testing with Kotlin

Talkat Android Makers 2019 · on Tuesday, 2019-04-23· [testing, kotlin]
slides:none on file

Forty minutes of live coding shows concrete recipes: replace JUnit asserts with Kluent assertions, prefer Mockito-Kotlin or MockK / Mockito-Kotlin for cleaner mocks and coroutine helpers like verifyBlocking or co-verify, and avoid global coroutines in tests. Coroutines testing uses runBlockingTest / the new runBlockingTest builder, a test coroutine dispatcher to advance virtual time (advanceTimeBy, triggerActions), capture and rethrow parallel exceptions, and override Dispatchers.Main during setup; several example classes (Tournament, Game, ImageFilter) get built and the fixes make the tests reliable.

AI-written summary · about

  1. 0:00Live coding intro
  2. 1:07Kotlin unit testing basics
  3. 10:24Testing exceptions with JUnit 5
  4. 12:30Mocking in Kotlin
  5. 15:20Coroutines testing intro
  6. 17:30Challenges with suspend functions
  7. 20:39Blocking vs non-blocking coroutine tests
  8. 23:28Testing coroutine cancellation
  9. 26:36Test coroutine context
  10. 30:07Structured concurrency testing
  11. 38:07Coroutine dispatcher tests
  12. 41:00Future of coroutine testing
  13. 42:52Summary
~/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.