uiautomator使用手册.docVIP

  • 24
  • 0
  • 约7.96千字
  • 约 11页
  • 2018-02-17 发布于浙江
  • 举报
uiautomator使用手册

使用环境: 1 Android Document: 4 创建一个uiautomator的测试工程: 4 运行比较简单: 4 怎么建立一个工程: 4 1. 创建测试工程 4 2. Eclipse创建一个工程(见上) 4 3. 编写代码 5 4. Build(通过Eclipse见上图),ant build 5 操作类函数: 5 点屏幕上的控件或坐标操作 5 拖拽 6 长按 6 其他操作 7 获得屏幕属性的函数接口: 8 验证工作: 9 强大的监控管家, 10 使用环境: JDK /technetwork/java/javase/downloads/index.html 安装后应该JAVA_HOME在环境变量里面,如果没有手动加,比如我的是JAVA_HOME C:\Program Files\Java\jdk1.7.0_17 Android SDK /sdk/index.html 环境变量: ANDROID_HOME=你的android sdk根目录,我的是C:\adt-bundle-windows-x86_64sdk Adb环境变量,tools环境变量 比如我的是 C:\adt-bundle-windows-x86_64sdk\tools;C:\adt-bundle-windows-x86_64sdk\platform-tools Monitor.bat 在tools里可以找到,用来查看屏幕上的组件 WinAnt 编译工具 /p/winant/downloads/list 安装完之后应该就有环境变量 ANT_HOME=C:\Program Files (x86)\WinAnt Better to have: Eclipse用于编写编译: /downloads/ Eclipse IDE for Java Developers, 步骤: Create a new Java project in Eclipse, and give your project a name that is relevant to the tests you’re about to create (for example, MyAppNameTests). In the project, you will create the test cases that are specific to the application that you want to test. From the?Project Explorer, right-click on the new project that you created, then select?Properties Java Build Path, and do the following: Click?Add Library JUnit?then select?JUnit3?to add JUnit support. Click?Add External JARs...?and navigate to the SDK directory. Under the platforms 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: /tools/testing/testing_ui.html /tools/testing/testing_ui.html#configure /tools/help/uiautomator/index.html 创建一个uiautomator的测试工程: android-sdk/tools/android create uitest-project -n name -t 1 -p path -t android_id必须大于等于16, 用android list可以得到当前列表 建议只下载android4.2.2,因为api=16里面接口太少了,达不到使用的目的,手机也必须刷成android4.2.2的(现在Dongo,Odin, Pelican都可以) 注意:拷贝实例中的工程需要修改perties 注销掉这种字眼#sdk.dir=C:\\adt-bundle-windows-x86

文档评论(0)

1亿VIP精品文档

相关文档