1、在eclipse新建uiautomator测试脚本,代码如下:
2、打开cmd
(1)使用命令生成build.xml文件
D:\adt-bundle-windows-x86_64-20130917\sdk\platform-tools>android create uitest-p
roject -n search -t 1 -p e:\GitHub\appMarket
(2)生成jar包
E:\GitHub\appMarket>ant build
(3)将生成的jar包push到测试机(data/local/tmp)
注意:data/local/tmp 格式
D:\adt-bundle-windows-x86_64-20130917\sdk\platform-tools>adb push e:\GitHub\appMarket\bin\search.jar data/local/tmp
(4)启动脚本:运行push到测试机的jar包
D:\adt-bundle-windows-x86_64-20130917\sdk\platform-tools>adb shell uiautomator r
untest search.jar -c com.testcases.Search01