android - 没有测试的模块中的 "No tests found"错误

标签 android gradle android-testing android-instrumentation

在运行 gradlew connectedAndroidTest 时,对于没有仪器测试(仅 JUnit 测试)的特定模块,我收到“未找到测试”错误。在管线中。这是一件坏事,因为该应用程序的其他模块已检测到由于 Gradle 任务失败而无法运行的测试。
Task :actions:connectedDebugAndroidTest
Starting 0 tests on android_emulator(AVD) - 8.1.0
com.android.build.gradle.internal.testing.ConnectedDevice > No tests found.android_emulator(AVD) - 8.1.0 FAILED
No tests found. This usually means that your test classes are not in the form that your test runner expects (e.g. don't inherit from TestCase or lack @Test annotations).
Task :actions:connectedDebugAndroidTest FAILED
我试过删除 androidTest依赖项和 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"但问题仍然存在。

最佳答案

删除androidTest目录解决了问题(该文件夹没有类,但有一个 .gitkeep 文件)。
显然,当文件夹存在但其中没有测试时它会失败。

关于android - 没有测试的模块中的 "No tests found"错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64396277/

相关文章:

android - Android Studio Gradle在Android L上设置了目标API

android - 安装应用程序和 espresso 测试 apk 并在设备上运行

android - OpenCV native 示例未构建

Android:如何从 IME 设置首选键盘 View 模式

Android JUNIT 获取键盘 View

android - 如何显示具体的商品数量?

android - Android Studio仅在选择“生成APK”时签名APK,而在单击“运行”按钮时不签名

gradle - Kotlin gradle 插件 - 如何使用自定义输出目录?

android - 我无法使用 Espresso 单击复选框

android - Robolectric,点击列表项的问题