uiautomator使用

1.creat project android

add   "android.jar" , "uiautomartor.jar" api

new a class , class extends UiautomatorTestCase, ui

for example: spa

public class UiTest extends UiAutomatorTestCase {
public void test() throws UiObjectNotFoundException {
UiDevice.getInstance().pressMenu();
// UiObject object = new UiObject(new UiSelector().textContains("關於"));
// object.click();
}
} xml

2.ant build project get

DOS->android create uitest-project -n projectName -t num -p path it

 projectName: the name of your project io

num:the number of you android api level,if your environment is two api level,android-16,android-17,the num is 2. class

path:the path of you project+project name test

3.build project

modify build.xml: default="build"

right click build.xnl->Run as->ant build

3.push jar

DOS->adb push xxx.jar /data/local/tmp

xxx.jar: you project path\bin

4.run

DOS->uiautomator runtest xxx.jar -c packageName

packageName:you package name of you project

相關文章
相關標籤/搜索