`

自动测试—UiAutomator中文输入测试

 
阅读更多

一、安装输入法:
1,去utf7ime的 github上把整个项目给下载下来,地址:https://github.com/sumio/uiautomator-unicode-input-helper
点击"Download ZIP"按钮进行 打包下载,如图:

 

2,下载完成 以后解压到本地磁盘的任意位置比如C:\uiautomator-unicode-input-helper-master
3,打开Eclipse(安装了adt,并且配置好sdk home in eclispe不然不能打包)
4, 点击File->Import ->Existing Android Code Into Workspace->Next->点击Browser 选择uiautomator-unicode-input-helper-master\Utf7Ime文件夹>点击Done,这个提示发现不了 project,请从别的android项目中复制根目录下的配置文件过来就ok了(配置文件.classpath .project proguard.cfg project.properties)
5,导入成功后,安装IME(input method Editor)到手机中;

6,设置-语言及输入法-在设置里面将本机的默认输入法设置成:UTF7 IME for UI Testing,同时取消第三方的输入法(如果你安装了);

 

 

二、在测试工程中加入对应的代码

1.将uiautomator-unicode-input-helper-master\helper-library  目录下的src拷贝到测试项目中

2.可使用sample中代码做测试,如下:

public class UiAutomatorInputTest extends UiAutomatorTestCase {
    public void testDemo() throws UiObjectNotFoundException {

        // Press on the HOME button.
        getUiDevice().pressHome();

        // Launch the "Google" apps via the All Apps screen.
        UiObject allAppsButton = new UiObject(new UiSelector().description("Apps"));
        allAppsButton.clickAndWaitForNewWindow();
        UiObject appsTab = new UiObject(new UiSelector().text("Apps"));
        appsTab.click();
        UiScrollable appViews = new UiScrollable(new UiSelector().scrollable(true));
        appViews.setAsHorizontalList();
        UiObject testApp = appViews.getChildByText(new UiSelector().className(android.widget.TextView.class.getName()),
                "Google");
        testApp.clickAndWaitForNewWindow();

        // Get the google search text box
        UiObject searchBox = new UiObject(
                new UiSelector().className("com.google.android.search.shared.ui.SimpleSearchText"));

        // do Japanese Input!
        searchBox.setText(Utf7ImeHelper.e("こんにちは!UiAutomatorで入力しています。"));
    }

}

 搞定收工!!

 

转:http://blog.csdn.net/g19920917/article/details/37518883

分享到:
评论

相关推荐

    Android UiAutomator 自动化测试

    UiAutomator2,Android Studio工程,支持中文输入 UiAutomator 谷歌推出的,用于UI自动化测试的工具 Android 4.1及以上,不支持Hybird App、WebApp 基于Java,测试代码结构简单、编写容易 直接在手机上运行 配合ui...

    Android自动化测试UIautomator-UiObject

    UI Automator 是 Android 提供的一个 UI 自动化测试框架,可以用来实现自动化测试。UiObject 是这个框架中最常用的工具之一,它可以代表应用程序中的某个 UI 元素,并提供了一系列方法帮助测试人员进行 UI 操作和...

    基于uiautomator2框架的移动UI自动化测试实验设计

    移动UI自动化测试是一种软件测试方法,用于自动化测试移动应用程序的用户界面(UI)上的交互和...它与Web应用程序UI自动化测试类似,但需要考虑到移动应用程序的特殊性质,例如屏幕尺寸、触摸输入、移动网络连接等。

    Android 自动化测试框架

     是Android SDK自带的测试工具,是一个命令行工具,可以运行在模拟器中或者实际设备中,它向系统发送伪随机的用户事件流(如按键输入,触摸屏输入,手势输入等),实现对正在开发的应用程序进行压力测试。由于测试...

    UIAutomatorTest:这包含 Android 应用程序的自动化脚本

    Android SDK 提供了 uiautomator ,一个用于自动化和运行测试的 Java 库。 除此之外,它还提供了一个名为 uiautomatorviewer 的 GUI 工具,用于检查布局层次结构并查看测试设备上各个 UI 组件的属性。 有关 ...

    Android自动化测试--UIAutomator使用

    同时删除自动生成的一些文件,最终目录结构如下:Paste_Image.png接下来我们看看如何一步一步的使用Espresso,首先在根目录的build.gradle文件中添加下面的引入。在app目录中的build.gradle文件中添加下面的引入,...

    uiautomatorviewer.jar

    Android 4.1发布的,uiautomator是用来做UI测试的。也就是普通的手工测试,点击每个控件元素 看看输出的结果是否符合预期。... 功能性或者黑盒UI测试不需要测试人员了解程序...而uiautomator 就是你的自动化UI测试工具。

    UiTestAndroid:UiAutomator解析xml测试

    UiTestAndroid 是一个 Record and Replay 应用程序,用于在物理设备上的 Android 应用程序中执行自动图形界面测试。 使用 UiTestAndroid 生成的测试用例可以导出到不同类型的设备。 该应用程序提供点击屏幕坐标、...

    Auto.js:一个主要由无障碍服务实现的不需要Root权限的类似按键精灵的自动操作软件,可以实现自动点击、滑动、输入文字、打开应用等

    类似于Google的UI测试框架UiAutomator,您也可以把他当做移动版UI测试框架使用 采用JavaScript为脚本语言,并支持代码补全、变量重命名、代码格式化、查找替换等功能,可以作为一个JavaScript IDE使用 支持使用e4x...

    类似按键精灵的自动操作软件

    作者hyb1996,源码Auto.js,一个主要由无障碍服务实现的不需要Root权限的类似按键精灵的自动操作软件,可以实现自动点击、滑动、输入文字、打开应用等。 同时有Sublime Text 插件可提供基础的在桌面开发的功能。 ...

    APP_UI.rar

    自动化个人学习第一步笔记import os import time import logging import configparser from appium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.support import ...

Global site tag (gtag.js) - Google Analytics