1、打开Eclipse

快学UiAutomator新建第一个测试工程

 

2、新建一个java项目,包

快学UiAutomator新建第一个测试工程

快学UiAutomator新建第一个测试工程

 

3、增加build path,加载需要的库文件jar包

快学UiAutomator新建第一个测试工程

 

4、新建测试类,继承UIAutomatorTestCase

快学UiAutomator新建第一个测试工程

 

 

5、编写测试用例,方法名必须test开头

快学UiAutomator新建第一个测试工程

6、编译并运行

6.1 使用cmd 进入项目当前路下

快学UiAutomator新建第一个测试工程

6.2 使用android create 编译成一个build.xml文件

快学UiAutomator新建第一个测试工程

6.3 进入eclipse里面进行更改build.xml文件help改为build

快学UiAutomator新建第一个测试工程

6.4 进行运行编译

快学UiAutomator新建第一个测试工程

 

6.5 把生成的jar包push到手机中

快学UiAutomator新建第一个测试工程

6.6 运行jar包启动测试

adb shell uiautomator runtest uiautomatordemo.jar -c com.jekouxueyuan.Test

 

相关文章: