Testing with Kotlin
summary
Shows concrete recipes: uses JUnit 5 indexes arguments from 1 to explain parameterized-test differences, replaces JUnit runners with KotlinTest/Kotest StringSpec and Spek for readable output, and swaps Mockito for MockK supports multiplatform or mockito-kotlin extensions. Builds test helpers: factory methods with default args to avoid tedious DI constructors, an extension to invoke ViewModel cleanup (onCleared) in unit tests, and a robot abstraction records rendered view states in order to verify MVI chat flows end-to-end. Examples live in the repo.
AI-written summary · about
chapters (17)
- 0:00Intro
- 1:28Use cases
- 2:44Parametrize test
- 5:58Coding test
- 7:52Spec framework
- 9:22Mockito
- 10:34Mockito extensions
- 12:07Final thoughts
- 15:13Model View Presenter
- 17:08Model View Model
- 19:21Model View Intent
- 20:35Model View Robot
- 21:19Model View Intent specification
- 22:28Why spec
- 23:35Example
- 24:36Annotations
- 29:29What testing
related talks
41mTesting in Kotlin: The Holy Grail of Readability and Power
28mTesting Out Kotlin
49mTesting Kotlin at Scale: Spek
25mIdiomatic Kotlin in Tests
43mEffective Unit testing with Kotlin
01h 29mIntro to unit testing coroutines with Kotest & MockK
30mGet a Cool Unit Test Environment with Spek2 + MockK + JaCoCo
39mTesting in Kotlin
