当我处理测试时 - 我在特殊模块中添加类并运行测试配置。类扩展(例如)TestCase 并且运行良好。
但是当我扩展 UiAutomatorTestCase - 我得到错误
java.lang.RuntimeException: Stub!
at com.android.uiautomator.testrunner.UiAutomatorTestCase.<init> (UiAutomatorTestCase.java:5) ...
我的简单类:
import com.android.uiautomator.core.UiObjectNotFoundException;
import com.android.uiautomator.testrunner.UiAutomatorTestCase;
public class AutoTest extends UiAutomatorTestCase {
public void testSome() throws UiObjectNotFoundException {
getUiDevice().pressHome();
}
}
如何在Android Studio IDE中运行?
最佳答案
好吧,如果您有兴趣再试一次....我能够在 Android Studio 中使用以下 [Github 项目] ( https://github.com/wiliamsouza/bluetooth ) 启动 UIAutomator 项目
- 在本地克隆项目。
- 编辑 gradle.properties 文件以指向您的 sdk、目标和构建工具
- 导入 Android Studio,如果出现提示,请务必选择 Gradle。
随附的 [博文] ( http://wiliamsouza.github.io/#/2013/10/30/android-uiautomator-gradle-build-system ) 有更多详细信息。
我用自己的测试用例进行了修改并且运行良好。
关于android - 从 Android Studio (v0.8) 运行 UiAutomator API,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25217199/