My android app is multi module project:
include (android-app/kotlin-android)':application', (pure kotlin)':presentation', (pure kotlin)':domain', (android-library/kotin-android)':dataproviders'
I'm using Junit/Mockito for tests and I have issue with generating code coverage for kotlin android modules only. Tested lines are visible for android studio.
tested class in ui.viewmodel package:
But, for pure kotlin (eg. domain, presentation) test coverage works fine:
I'm using Android Studio 3.0 Canary 8 You can look at my build.gradle files at github:
build.gradle
dependencies.gradle
application.build.gradle
presentation.build.gradle
Example test in android application module:
MostPopularViewModelTest
Example test in pure kotlin module:
MostPopularPresenterTest
Can someone help me with my problem? I tried generate code coverage via Jacoco but it also did not show code coverage.
Solution is to add this this gradle task in build.gradle for module:
task copyTestClasses(type: Copy) {
from "build/tmp/kotlin-classes/debugUnitTest"
into "build/intermediates/classes/debug"
}
And run:
gradlew copyTestClasses
Then generate code coverage report without problems.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With