简体   繁体   English

从Android Studio运行UiAutomator API(v0.8)

[英]Run UiAutomator API from Android Studio (v0.8)

When I work with tests - I add class in special module and run test configuration. 当我使用测试时 - 我在特殊模块中添加类并运行测试配置。 Class extend (for example) TestCase and work well. 类扩展(例如)TestCase并且运行良好。

But when I extend UiAutomatorTestCase - I get error 但是当我扩展UiAutomatorTestCase时 - 我得到了错误

java.lang.RuntimeException: Stub!
    at com.android.uiautomator.testrunner.UiAutomatorTestCase.<init>  (UiAutomatorTestCase.java:5) ...

My simple class: 我的简单课程:

import com.android.uiautomator.core.UiObjectNotFoundException;
import com.android.uiautomator.testrunner.UiAutomatorTestCase;

public class AutoTest extends UiAutomatorTestCase {
    public void testSome() throws UiObjectNotFoundException {
        getUiDevice().pressHome();
    }
}

How to run it in Android Studio IDE? 如何在Android Studio IDE中运行它?

Well, if you'd be interested in giving it another try....I was able to get a UIAutomator project started in Android Studio with the following [Github project] ( https://github.com/wiliamsouza/bluetooth ) 好吧,如果你有兴趣再试一次....我能够通过以下[Github项目]( https://github.com/wiliamsouza/bluetooth )获得在Android Studio中启动的UIAutomator项目

  1. Clone the project locally. 在本地克隆项目。
  2. Edit the gradle.properties file to point to your sdk, target and build tools 编辑gradle.properties文件以指向您的sdk,目标和构建工具
  3. Import into Android Studio, if prompted be sure to select Gradle. 导入到Android Studio,如果提示,请务必选择Gradle。

The accompanying [blog post] ( http://wiliamsouza.github.io/#/2013/10/30/android-uiautomator-gradle-build-system ) has more details. 随附的[博客文章]( http://wiliamsouza.github.io/#/2013/10/30/android-uiautomator-gradle-build-system )有更多细节。

I modified with my own test cases and is working well. 我用自己的测试用例进行了修改,运行良好。

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

相关问题 Android Studio V0.8无法创建新的Glass Module,错误为“组件Glass Module的最低SDK级别为19” - Android studio V0.8 cannot create new Glass Module with error “The component Glass Module has a minimum SDK level of 19” 使用低于API级别19(4.4)的设备使用android studio 0.8.x录制屏幕吗? - Record screen using android studio 0.8.x from a device below API Level 19(4.4)? 在没有Android Studio运行选项的情况下运行UiAutomator测试 - Running UiAutomator tests without Android Studio run option Android Studio 0.8中的单元测试 - Unit tests in Android Studio 0.8 ADB转储视图层次结构与Android Studio中的UiAutomator不同吗? - ADB dump view hierarchy different from UiAutomator in Android Studio? Android Studio 0.8-不再运行自定义任务 - Android Studio 0.8 - No longer runs custom tasks 将Android Studio更新到版本0.8(测试版) - Updating Android Studio to version 0.8 (beta) Android Studio 0.8屏幕录制有麦克风吗? - Android Studio 0.8 screen record with microphone? 设置android studio 0.8的本地文档 - Set local documentation for android studio 0.8 使用AndroidAnnotations从Android Studio 0.8到1.0版本迁移android应用程序项目 - Migrating android application project using AndroidAnnotations from Android Studio 0.8 to 1.0 version
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM