uiautomator使用手册

上传人:人*** 文档编号:508909707 上传时间:2022-12-23 格式:DOCX 页数:14 大小:139.98KB
返回 下载 相关 举报
uiautomator使用手册_第1页
第1页 / 共14页
uiautomator使用手册_第2页
第2页 / 共14页
uiautomator使用手册_第3页
第3页 / 共14页
uiautomator使用手册_第4页
第4页 / 共14页
uiautomator使用手册_第5页
第5页 / 共14页
点击查看更多>>
资源描述

《uiautomator使用手册》由会员分享,可在线阅读,更多相关《uiautomator使用手册(14页珍藏版)》请在金锄头文库上搜索。

1、uiautomator使用手册使用环境 : . 1AndroidDocument:. 4创建一个 uiautomator的测试工程 : . 4运行比较简单 : . 4怎么建立一个工程 : . 41. 创建测试工程 . 42. Eclipse创建一个工程 ( 见上 ) .53. 编写代码 . 54. Build(通过Eclipse见上图 ) ,antbuild . 5操作类函数 :. 5点屏幕上的控件或坐标操作 . 5拖拽 . 6长按 . 6其他操作 . 7获得屏幕属性的函数接口 :. 8验证工作 : . 9强大的监控管家, . 10使用环境 :JDK安装后应该 JAVA_HOME在环境变量里面

2、,如果没有手动加,比如我的是Android SDK环境变量 :ANDROID_HOME=你的 android sdk根目录,我的是C:adt-bundle-windows-x86_64-20130522sdkAdb 环境变量, tools环境变量比如我的是C:adt-bundle-windows-x86_64-20130522sdktools;C:adt-bundle-windows-x86_64-20130522sdkplatform-tools,Monitor.bat在 tools里可以找到,用来查看屏幕上的组件WinAnt 编译工具安装完之后应该就有环境变量ANT_HOME=C:Prog

3、ram,Files,(x86)WinAnt,Better to have:Eclipse用于编写编译 :Eclipse IDE for Java Developers,步骤 :1. Create a new Java project in Eclipse, and give your project a name that is relevant to thetests you re about to create (for example, MyAppNameTests). In the project, you will createthe test cases that are spec

4、ific to the application that you want to test. 2. From the Project Explorer, right-click on the new project that you created, thenselect Properties Java Build Path, and do the following:a. Click Add Library JUnit then select JUnit3 to add JUnit support.b. Click Add External JARs. and navigate to the

5、 SDK directory.Under theplatforms directory, select the latest SDK version and add both the uiautomator.jar and android.jar files.在 eclipse 配置 ant build ,如果不想使用 eclipse 编译而手动使用 ant build 命令来编译也行也挺方便。Your project右键 Properties, Builders-New-Set Targets:选择 build和 jar:Android Document:#configure创建一个 uia

6、utomator的测试工程 :/tools/android create uitest-project -n -t 1 -p -t android_id必须大于等于 16, 用 android list可以得到当前列表建议只下载,因为 api=16 里面接口太少了,达不到使用的目的,手机也必须刷成的 ( 现在 Dongo, Odin, Pelican 都可以 )注意 : 拷贝实例中的工程需要修改local.properties注销掉这种字眼 #sdk.dir=C:adt-bundle-windows-x86_64-20130522sdk因为工程会自动寻找ANDROID_HOME环境变量。环境变

7、量里面有 ANDROID_HOME=你的 android sdk 根目录,我的是 C:adt-bundle-windows-x86_64-20130522sdk运行比较简单 :adb shell uiautomator runtest xxxxxx.jar -c packageName#MethodNameadb shell uiautomator runtest uiautotest.jar,xxx.jar -c package.className, package.class#method怎么建立一个工程 :1. 创建测试工程/tools/android create uitest-project -n -t 1-p 2. Eclipse创建一个工程 ( 见上 )把步骤 1 内的东西拷贝到 eclipse建立的工程里头3. 编写代码4. Build(通过 Eclipse见上图 ) ,ant build操作类函数 :点屏幕上的控件或坐标操作public void clickChildByText(String cls, String text, booleanisNewWindow) 点属于 cls 的类名下面的含有text的控件,如果点开的是新窗口就

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 办公文档 > 演讲稿/致辞

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号