两个月左右,我一直无法在 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/