Interested to find code coverage tools for kotlin that work well in a CI pipeline. use intellij built in code coverage but cant use this in CI. Thanks
Asked
Active
Viewed 2,451 times
6
-
I believe development is happening on various plugins/tools for this. Meanwhile check this: https://discuss.kotlinlang.org/t/gradle-code-coverage-report/390 – jitinsharma Nov 24 '17 at 09:58
2 Answers
2
The Jacoco plugin works fine for coverage of Kotlin code. Configure Jacoco the same as you would for Java.
https://docs.gradle.org/current/userguide/jacoco_plugin.html

Mikezx6r
- 16,829
- 7
- 33
- 31
-
3JaCoCo incorrectly marks some lines as "partially covered by tests". See https://stackoverflow.com/questions/45525279/how-to-avoid-partial-coverage-with-lateinit-fields-in-kotlin – Paulo Merson Nov 12 '18 at 15:36
2
You can use the new kotlinx-kover Gradle plugin compatible with JaCoCo and IntelliJ.
plugins {
id("org.jetbrains.kotlinx.kover") version "0.5.0"
}
Once applied, the plugin can be used out of the box without additional configuration.
Watch its YouTube announcement video and also track its roadmap from this youtrack issue.

Mahozad
- 18,032
- 13
- 118
- 133