1、在cmd中运行如下命令,生成build.xml文件,位于 E:\Users\Administrator\workspace\beixunUiautomatorTest目录下
android create uitest-project -n beixunUiautomatorTest -t 31 -p E:\Users\Administrator\workspace\beixunUiautomatorTest
2、修改build文件,将<project name="beixunUiautomatorTest" default="help">修改为<project name="beixunUiautomatorTest" default="build">,接下来build.xml文件执行ant,执行默认目标
ant -buildfile E:\Users\Administrator\workspace\beixunUiautomatorTest\build.xml
3、连接手机,将生成的beixunUiautomatorTest.jar push到手机/data/local/tmp目录下
adb push E:\Users\Administrator\workspace\beixunUiautomatorTest\bin\beixunUiautomatorTest.jar /data/local/tmp
4、执行指定测试用例adb shell uiautomator runtest beixunUiautomatorTest.jar -c com.beixun.test.inputTest
备注:文字红字加粗字体可替换成实际操作名称