一、运行命令介绍:
#Test.java package com.uiautomatortest; import android.os.Bundle; import android.os.RemoteException; import com.android.uiautomator.core.UiDevice; import com.android.uiautomator.testrunner.UiAutomatorTestCase; public class Test extends UiAutomatorTestCase { public void testHome(){ UiDevice.getInstance().pressHome(); sleep(2000); } public void testMenu(){ UiDevice.getInstance().pressMenu(); sleep(2000); } public void testRecent() throws RemoteException{ UiDevice.getInstance().pressRecentApps(); sleep(2000); } public void testDemo(){ UiDevice.getInstance().pressHome(); sleep(2000); Bundle bundle=getParams(); String phone=bundle.getString("phone"); System.out.println("PHONE="+phone); } }