UiAutomatorRunner

public class UiAutomatorRunner
extends Object implements IRemoteAndroidTestRunner

java.lang.Object
com.android.tradefed.testtype.UiAutomatorRunner


在裝置上執行 UI Automator 測試並報告結果。 UI Automator 測試是一個專用的測試運行器,用於運行利用 UI Automator 框架的 UI 自動化測試。裝置上的測試執行程式模擬儀器測試輸出格式,以便可以重複使用 ddmlib 和 TF 中的現有解析程式碼。本質上,這是此命令的包裝器: adb shell uiautomator runtest (jar files) -e class (測試類別) ...

概括

公共構造函數

UiAutomatorRunner (IDevice remoteDevice, String[] jarPaths, String runnerPath)

建立 UiAutomatorRunner 來執行 UI 自動化測試

公共方法

void addBooleanArg (String name, boolean value)

void addInstrumentationArg (String name, String value)

void cancel ()

IRemoteAndroidTestRunner.CoverageOutput getCoverageOutputType ()
String getPackageName ()

傳回最後新增的 Java 類別的套件名稱

String getRunnerName ()

傳回預設的 UiAutomatorTestRunner 類別名

void removeInstrumentationArg (String name)

void run (ITestRunListener... listeners)

void run ( listeners) run ( listeners)

void setAdditionalTestOutputLocation (String additionalTestDataPath)
void setClassName (String className)

void setClassNames (String[] classNames)

void setCoverage (boolean coverage)

void setCoverageReportLocation (String arg0)
void setDebug (boolean debug)

void setIgnoreSighup (boolean value)

設定 uiautomator 中的選項以忽略 SIGHUP。

void setLogOnly (boolean logOnly)

void setMaxTimeToOutputResponse (long timeout, TimeUnit unit)

void setMaxTimeout (long maxTimeout, TimeUnit unit)
void setMaxtimeToOutputResponse (int maxTimeToOutputResponse)

此方法已被棄用。使用setMaxTimeToOutputResponse(long, TimeUnit)代替。

void setMethodName (String className, String testName)

void setRunName (String runName)

void setTestCollection (boolean b)
void setTestPackageName (String packageName)

void setTestSize (IRemoteAndroidTestRunner.TestSize size)

受保護的方法

String getRunCommand ()
String getRunnerPath ()

公共構造函數

UiAutomatorRunner

public UiAutomatorRunner (IDevice remoteDevice, 
                String[] jarPaths, 
                String runnerPath)

建立 UiAutomatorRunner 來執行 UI 自動化測試

參數
remoteDevice IDevice :與之互動的遠端設備:執行測試、收集結果等

jarPaths String :UI Automator 測試案例所在的 jar 檔案的路徑;路徑必須是絕對路徑或相對於裝置上的 /data/local/tmp/

runnerPath String :要使用的替代 uiautomator 運行程序,可能為null ,在這種情況下將使用預設值

公共方法

新增布林參數

public void addBooleanArg (String name, 
                boolean value)

參數
name String

value boolean

添加InstrumentationArg

public void addInstrumentationArg (String name, 
                String value)

參數
name String

value String

取消

public void cancel ()

取得覆蓋輸出類型

public IRemoteAndroidTestRunner.CoverageOutput getCoverageOutputType ()

退貨
IRemoteAndroidTestRunner.CoverageOutput

取得包名

public String getPackageName ()

傳回最後新增的 Java 類別的套件名稱

退貨
String

獲取跑步者姓名

public String getRunnerName ()

傳回預設的 UiAutomatorTestRunner 類別名

退貨
String

刪除InstrumentationArg

public void removeInstrumentationArg (String name)

參數
name String

跑步

public void run (ITestRunListener... listeners)

參數
listeners ITestRunListener

投擲
AdbCommandRejectedException
ShellCommandUnresponsiveException
TimeoutException

跑步

public void run ( listeners)

參數
listeners

投擲
AdbCommandRejectedException
ShellCommandUnresponsiveException
TimeoutException

設定附加測試輸出位置

public void setAdditionalTestOutputLocation (String additionalTestDataPath)

參數
additionalTestDataPath String

設定類別名稱

public void setClassName (String className)

參數
className String

設定類別名稱

public void setClassNames (String[] classNames)

參數
classNames String

設定覆蓋範圍

public void setCoverage (boolean coverage)

參數
coverage boolean

設定覆蓋率報告位置

public void setCoverageReportLocation (String arg0)

參數
arg0 String

設定調試

public void setDebug (boolean debug)

參數
debug boolean

設定忽略警告

public void setIgnoreSighup (boolean value)

設定 uiautomator 中的選項以忽略 SIGHUP。

參數
value boolean :如果設定為 true 則忽略訊號

設定僅記錄

public void setLogOnly (boolean logOnly)

參數
logOnly boolean

設定輸出響應最大時間

public void setMaxTimeToOutputResponse (long timeout, 
                TimeUnit unit)

參數
timeout long

unit TimeUnit

設定最大超時時間

public void setMaxTimeout (long maxTimeout, 
                TimeUnit unit)

參數
maxTimeout long

unit TimeUnit

設定輸出響應最大時間

public void setMaxtimeToOutputResponse (int maxTimeToOutputResponse)

此方法已被棄用。
使用setMaxTimeToOutputResponse(long, TimeUnit)代替。

參數
maxTimeToOutputResponse int

設定方法名

public void setMethodName (String className, 
                String testName)

參數
className String

testName String

設定運行名稱

public void setRunName (String runName)

參數
runName String

設定測試集合

public void setTestCollection (boolean b)

參數
b boolean

設定測試包名稱

public void setTestPackageName (String packageName)

參數
packageName String

設定測試大小

public void setTestSize (IRemoteAndroidTestRunner.TestSize size)

參數
size IRemoteAndroidTestRunner.TestSize

受保護的方法

取得運行命令

protected String getRunCommand ()

退貨
String

取得跑步者路徑

protected String getRunnerPath ()

退貨
String