简体   繁体   English

不能再在 Android Studio 中运行单独的仪器测试

[英]Can no longer run individual instrumented tests in Android Studio

For two months or so now I haven't been able to run individual UI tests in Android Studio.大约两个月以来,我一直无法在 Android Studio 中运行单独的 UI 测试。 Right clicking on the test name and then run <test name> just give me the error No tests were found .右键单击测试名称,然后run <test name>只是给我错误No tests were found If I right click on the class name and then click run <testing class name> , it successfully runs all the tests in the class.如果我右键单击 class 名称,然后单击run <testing class name> ,它会成功运行 class 中的所有测试。 So in order to just run an individual test in a class I have to resort to commenting out all the tests I don't want to run and then clicking on run from the class name which is a pain.因此,为了仅在 class 中运行单个测试,我必须诉诸注释掉我不想运行的所有测试,然后单击 class 名称中的运行,这很痛苦。 This used to work fine a couple of months ago.这在几个月前曾经工作得很好。

I really don't have much more information to go off of.我真的没有更多关于 go 的信息了。 The only output is唯一的 output 是

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"

Even years later (August 2022), same issue with latest Android Studio IDE;甚至多年后(2022 年 8 月),与最新的 Android Studio IDE 相同的问题;

In my experience, Android Studio 3.x was still able to run individual tests (no matter if individual-test-method or individual-test-class).根据我的经验,Android Studio 3.x 仍然能够运行单个测试(无论是单个测试方法还是单个测试类)。

I will try updating Gradle, and report back if that helps;-)我将尝试更新 Gradle,如果有帮助,请报告;-)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM