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 (test classes) ...
摘要
公用建構函式 | |
---|---|
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(
|
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)
這個方法已淘汰。
請改用 |
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 ,在這種情況下會使用預設值 |
公用方法
addBooleanArg
public void addBooleanArg (String name, boolean value)
參數 | |
---|---|
name |
String |
value |
boolean |
addInstrumentationArg
public void addInstrumentationArg (String name, String value)
參數 | |
---|---|
name |
String |
value |
String |
cancel
public void cancel ()
getCoverageOutputType
public IRemoteAndroidTestRunner.CoverageOutput getCoverageOutputType ()
傳回 | |
---|---|
IRemoteAndroidTestRunner.CoverageOutput |
getPackageName
public String getPackageName ()
傳回上次新增的 Java 類別套件名稱
傳回 | |
---|---|
String |
getRunnerName
public String getRunnerName ()
傳回預設的 UiAutomatorTestRunner 類別名稱
傳回 | |
---|---|
String |
removeInstrumentationArg
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 |
setAdditionalTestOutputLocation
public void setAdditionalTestOutputLocation (String additionalTestDataPath)
參數 | |
---|---|
additionalTestDataPath |
String |
setClassName
public void setClassName (String className)
參數 | |
---|---|
className |
String |
setClassNames
public void setClassNames (String[] classNames)
參數 | |
---|---|
classNames |
String |
setCoverage
public void setCoverage (boolean coverage)
參數 | |
---|---|
coverage |
boolean |
setCoverageReportLocation
public void setCoverageReportLocation (String arg0)
參數 | |
---|---|
arg0 |
String |
setDebug
public void setDebug (boolean debug)
參數 | |
---|---|
debug |
boolean |
setIgnoreSighup
public void setIgnoreSighup (boolean value)
將 uiautomator 中的選項設為忽略 SIGHUP。
參數 | |
---|---|
value |
boolean :如果設為 true,則忽略訊號 |
setLogOnly
public void setLogOnly (boolean logOnly)
參數 | |
---|---|
logOnly |
boolean |
setMaxTimeToOutputResponse
public void setMaxTimeToOutputResponse (long timeout, TimeUnit unit)
參數 | |
---|---|
timeout |
long |
unit |
TimeUnit |
setMaxTimeout
public void setMaxTimeout (long maxTimeout, TimeUnit unit)
參數 | |
---|---|
maxTimeout |
long |
unit |
TimeUnit |
setMaxtimeToOutputResponse
public void setMaxtimeToOutputResponse (int maxTimeToOutputResponse)
This method is deprecated.
請改用 setMaxTimeToOutputResponse(long, TimeUnit)
。
參數 | |
---|---|
maxTimeToOutputResponse |
int |
setMethodName
public void setMethodName (String className, String testName)
參數 | |
---|---|
className |
String |
testName |
String |
setRunName
public void setRunName (String runName)
參數 | |
---|---|
runName |
String |
setTestCollection
public void setTestCollection (boolean b)
參數 | |
---|---|
b |
boolean |
setTestPackageName
public void setTestPackageName (String packageName)
參數 | |
---|---|
packageName |
String |
setTestSize
public void setTestSize (IRemoteAndroidTestRunner.TestSize size)
參數 | |
---|---|
size |
IRemoteAndroidTestRunner.TestSize |
受保護的方法
getRunCommand
protected String getRunCommand ()
傳回 | |
---|---|
String |
getRunnerPath
protected String getRunnerPath ()
傳回 | |
---|---|
String |