Jacoco Is Reporting 0 Coverage Of Kotlin Classes By Unit Tests, In An Android Project
I'm using Android Gradle Plugin 3.0.0. I'm migrating an Android app from java to kotlin. My app has classes in Java and Kotlin, and tests are in Java. I run ./gradlew clean jacocoT
Solution 1:
I had to add includeNoLocationClasses = true
to my gradle file as follows, to make the jacoco report reflect the coverage of Kotlin classes by unit tests:
android {
testOptions {
unitTests {
all {
jvmArgs '-noverify', '-ea'
jacoco {
includeNoLocationClasses = true
}
}
includeAndroidResources = true
}
}
}
Note: this solution works for running tests from the command line, but I still get 0% coverage when running with coverage from inside Android Studio.
Post a Comment for "Jacoco Is Reporting 0 Coverage Of Kotlin Classes By Unit Tests, In An Android Project"