The state of code coverage for Kotlin
summary
Compares actual tools and failures: JaCoCo and JetBrains Coverage generally work but mis-map compiler-generated bytecode (try-with-resources, Kotlin inline functions, when-on-strings), causing lost branches; porting Sonar Kotlin from Java drops measured coverage from 95% to ~85–90%. Mutation testing (PITest/Mutation testing) finds missing assertions (string-hash collisions) but is slow (initial runs can be ~1h20m). Notes fixes: JaCoCo snapshot fixes composables; commercial arc mutate addresses Kotlin switch/hash issues; R8/bytecode instrumentation can break Android execution.
AI-written summary · about
chapters (16)
- 0:00Introduction
- 1:56Support for Ukraine
- 2:17What is code coverage
- 4:03History of Kotlin coverage
- 6:55Key Kotlin coverage tools
- 9:49Coverage vs language features
- 14:46Kotlin features break coverage
- 18:20Inline functions challenges
- 23:38Coroutines testing coverage
- 25:24Android Compose coverage issues
- 27:10K2 compiler coverage testing
- 28:59Observer effect in coverage
- 31:55Coverage measurement workarounds
- 32:57Performance impact of tools
- 35:05Summary and improvements
- 37:10Closing remarks & Q&A








