unit-testing - Kotlin - Android Studio 中的 Java 代码覆盖率显示 0% NOT WORKING
问题描述
在我在 Android 工作室的一个 android 项目中,我有一些用 Kotlin 编写的源文件和用 Java 编写的相应单元测试,现在当我尝试运行覆盖率的测试类时,它显示为 0%。所有测试都通过并运行良好,但覆盖率显示为 0%。
对于用 Java 编写的源文件以及测试类也在 Java 中的情况,它工作得非常好,唯一的问题是源类在 kotlin 中,而测试类在 Java 中,反之亦然。
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'
任何帮助表示赞赏,如果有人知道如何解决这个问题,请告诉我。谢谢
解决方案
推荐阅读
- python - DataFrame 创建奇怪的数据结构
- c# - 如何设计没有 TabControl 的 TabPage?
- html - 如何在 Javascript 中编写多个条件以更改班级?
- javascript - Vue JS error 解析错误:Unexpected token - 错误绝对没用
- spring - CustomAuthenticationProvider 不会被称为 spring-security 5.2
- node.js - 为什么我的 mern 应用无法部署到 Heroku?
- javascript - js打开txt文件逐行读取并转为数组
- python - groupby Pandas 限制行数
- c - 这两个环境变量 (a) environ b) envp) 的实际字符串存储在哪里?
- prometheus - Prometheus:0 偏移计数器