Kotlin - Android工作室中的Java代码覆盖率显示0%无法正常工作

时间:2018-05-15 03:45:47

标签: unit-testing android-studio-3.0 kotlin-android-extensions

在Android工作室的一个Android项目中,我有一些用Kotlin编写的源文件,还有用Java编写的相应的单元测试。现在,当我尝试运行带有覆盖率的测试类时,它显示0%。所有测试都通过并运行良好,但覆盖范围显示为0%。

对于使用Java编写的源文件以及测试类也使用Java编写的场景,它的工作非常精细,唯一的问题是当源类在Java中的kotlin和测试类时,反之亦然。

Gradle Version : 4.1
Kotlin Version : 1.1.61
play_services = "11.8.0"//9.4.0
support_version = "27.1.0"//23.+
espresso = "3.0.1"

testCompile 'junit:junit:4.12'
    //mockito
    testCompile "org.mockito:mockito-core:2.8.9" // PowerMockito works on 2.8.9
    testCompile "org.powermock:powermock-module-junit4:1.7.3"
    testCompile "org.powermock:powermock-api-mockito2:1.7.0RC2"

    androidTestCompile "com.android.support:support-annotations:$support_version"
    androidTestCompile 'com.android.support.test:runner:1.0.1'
    androidTestCompile 'com.android.support.test:rules:1.0.1'
    androidTestCompile "com.android.support.test.espresso:espresso-core:$espresso"
    androidTestCompile "com.android.support.test.espresso:espresso-intents:$espresso"
    androidTestCompile 'com.android.support.test.uiautomator:uiautomator-v18:2.1.3'
    androidTestCompile 'org.mockito:mockito-android:2.8.9'

感谢任何帮助,如果有人知道如何解决这个问题,请告诉我。感谢

0 个答案:

没有答案
相关问题