android - 无法再在 Android Studio 中运行单独的插桩测试

标签 android android-studio instrumented-test

两个月左右,我一直无法在 Android Studio 中运行单独的 UI 测试。右键单击测试名称,然后单击 run <test name>给我错误No tests were found .如果我右键单击类名,然后单击 run <testing class name> ,它成功地运行了类中的所有测试。因此,为了在一个类中运行一个单独的测试,我不得不求助于注释掉所有我不想运行的测试,然后从类名中单击运行,这很痛苦。几个月前,这曾经工作得很好。

我真的没有更多信息可以引用。唯一的输出是

Connected to the target VM, address: '127.0.0.1:49178', transport: 'socket'
Disconnected from the target VM, address: '127.0.0.1:49178', transport: 'socket'

Process finished with exit code 1
Class not found: "com.mypackagename.android.TestClassName"

最佳答案

甚至多年后(2022 年 8 月),最新的 Android Studio IDE 也出现同样的问题;

根据我的经验,Android Studio 3.x 仍然能够运行单独的测试(无论是 individual-test-method 还是 individual-test-class)。

我会尝试更新 Gradle,如果有帮助,我会反馈 ;-)

Update; No, the issue does not seem Gradle related.

(I tried both downgrade and update of Gradle, but the issue remains, and only downgrading Android-Studio to v3.x fixes the issue for me.)

关于android - 无法再在 Android Studio 中运行单独的插桩测试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59061165/

相关文章:

android - 找不到 support-v4.jar (com.android.support :support-v4:24. 0.0)

android - 如何断言可组合测试的下一个启动 Activity ?

android - 如何在android中处理FCM后台状态

android - GCM 生命周期困惑并希望始终注册

Android 当应用程序启动时显示白屏几秒钟?

android - fragment 不与 fragment 管理器相关联

android - 如何在 Android 中使用单元测试或仪器测试来测试警报管理器

javascript - 在 NativeScript 中在后台运行任务

android - FirebaseUI 登录方向

android-studio - 在 flutter 中将文件添加到git忽略