uiautomator简单使用(二)

来源:互联网 发布:高新区行知小学官网 编辑:程序博客网 时间:2024/06/06 20:10

UiAutomator官方推荐用于安装4.3版本以上

用于应用UI自动化测试,模拟操作

建立uiautomator测试工程

1:新建java工程

2:添加依赖包android.jar,uiautomator.jar

3:继承UiAutomatorTestCase

执行uiautomator测试

1:生成编译环境 android createutest-project

2:编译执行包  ant build

3:上传执行包到设备上 adb push

4:执行测试 adb shelluiautomator runtest

具体:Adb shell uiautomator runtest  jar名  -c java项目的包名.类名#方法名

下面是相关的截图:

 

查看当前机器上对应平台版本的id,后面要用


进入该目录用ant进行编译



遇到一个问题push不进去

百度然后解决:先要将adb 退出后再输入adb remount命令,它的意思是将设备改为可读可写。

然后关闭dos命令窗口,重新打开,必须要上传到那个目录下面

Adb shell uiautomator runtest  jar名  -c java项目的包名.类名#方法名