DeviceTestRunOptions
public
class
DeviceTestRunOptions
extends Object
| java.lang.Object | |
| ↳ | com.android.tradefed.testtype.junit4.DeviceTestRunOptions |
建構類別,用於透過 BaseHostJUnit4Test 執行裝置測試的相關選項。
摘要
公用建構函式 | |
|---|---|
DeviceTestRunOptions(String packageName)
|
|
公用方法 | |
|---|---|
DeviceTestRunOptions
|
addExtraListener(ITestLifeCycleReceiver listener)
在執行的檢測工具中新增額外監聽器。 |
DeviceTestRunOptions
|
addInstrumentationArg(String key, String value)
新增要傳遞至檢測工具的引數。 |
void
|
clearExtraListeners()
|
void
|
clearInstrumentationArgs()
清除先前使用 |
String
|
getApkFileName()
傳回 APK 安裝作業的 APK 檔案名稱。 |
ITestDevice
|
getDevice()
|
|
getExtraListeners()
|
String[]
|
getInstallArgs()
傳回安裝指令的額外選項。 |
|
getInstrumentationArgs()
|
Long
|
getMaxInstrumentationTimeoutMs()
|
Long
|
getMaxTimeToOutputMs()
|
String
|
getPackageName()
|
String
|
getRunner()
|
String
|
getTestClassName()
|
String
|
getTestMethodName()
|
Long
|
getTestTimeoutMs()
|
Integer
|
getUserId()
|
boolean
|
isForceQueryable()
是否應可查詢要安裝的 APK。 |
boolean
|
isGrantPermission()
是否要授予 APK 安裝權限。 |
boolean
|
isHiddenApiCheckDisabled()
|
boolean
|
isIsolatedStorageDisabled()
|
boolean
|
isRestartDisabled()
|
boolean
|
isTestApiCheckDisabled()
|
boolean
|
isWindowAnimationDisabled()
|
DeviceTestRunOptions
|
setApkFileName(String apkFileName)
設定 APK 安裝作業的 APK 檔案名稱。 |
DeviceTestRunOptions
|
setCheckResults(boolean checkResults)
設定是否應檢查檢測執行結果,並確保不會發生失敗。 |
DeviceTestRunOptions
|
setDevice(ITestDevice device)
|
DeviceTestRunOptions
|
setDisableHiddenApiCheck(boolean disableHiddenApiCheck)
設定是否要將 --no-hidden-api-checks 新增至主機端使用的「am 檢測工具」。 |
DeviceTestRunOptions
|
setDisableIsolatedStorage(boolean disableIsolatedStorage)
設定是否要將 --no-isolated-storage 新增至主機端使用的「am 檢測工具」。 |
DeviceTestRunOptions
|
setDisableRestart(boolean disableRestart)
設定是否要將 --no-restart 新增至主機端使用的「am 指標」。 |
DeviceTestRunOptions
|
setDisableTestApiCheck(boolean disableTestApiCheck)
設定是否要將 --no-test-api-access 新增至主機端使用的「am 檢測工具」。 |
DeviceTestRunOptions
|
setDisableWindowAnimation(boolean disableWindowAnimation)
設定是否要將 --no-window-animation 新增至主機端使用的「am 指標」。 |
DeviceTestRunOptions
|
setForceQueryable(boolean forceQueryable)
如果要安裝的 APK 不應可供查詢,就會設定 |
DeviceTestRunOptions
|
setGrantPermission(boolean grantPermission)
授予 APK 安裝權限。 |
DeviceTestRunOptions
|
setInstallArgs(String... installArgs)
設定安裝指令的額外選項。 |
DeviceTestRunOptions
|
setMaxInstrumentationTimeoutMs(Long maxInstrumentationTimeoutMs)
設定完整檢測作業必須執行及完成的時間上限 (以毫秒為單位)。 |
DeviceTestRunOptions
|
setMaxTimeToOutputMs(Long maxTimeToOutputMs)
設定檢測元件可在停止前停止輸出的時間上限 (以毫秒為單位)。 |
DeviceTestRunOptions
|
setRunner(String runner)
設定應用於執行檢測的檢測執行程式。 |
DeviceTestRunOptions
|
setTestClassName(String testClassName)
設定檢測工具應執行的類別名稱。 |
DeviceTestRunOptions
|
setTestMethodName(String testMethodName)
設定檢測工具應執行的方法名稱。 |
DeviceTestRunOptions
|
setTestTimeoutMs(Long testTimeoutMs)
設定測試可執行的最大時間 (以毫秒為單位)。 |
DeviceTestRunOptions
|
setUserId(Integer userId)
設定檢測工具應執行的使用者 ID。 |
boolean
|
shouldCheckResults()
|
公用建構函式
DeviceTestRunOptions
public DeviceTestRunOptions (String packageName)
| 參數 | |
|---|---|
packageName |
String |
公用方法
addExtraListener
public DeviceTestRunOptions addExtraListener (ITestLifeCycleReceiver listener)
在執行中的檢測工具中新增額外事件監聽器。
| 參數 | |
|---|---|
listener |
ITestLifeCycleReceiver |
| 傳回 | |
|---|---|
DeviceTestRunOptions |
|
addInstrumentationArg
public DeviceTestRunOptions addInstrumentationArg (String key, String value)
新增要傳遞至檢測工具的引數。
| 參數 | |
|---|---|
key |
String |
value |
String |
| 傳回 | |
|---|---|
DeviceTestRunOptions |
|
clearExtraListeners
public void clearExtraListeners ()
clearInstrumentationArgs
public void clearInstrumentationArgs ()
清除先前使用 addInstrumentationArg(String, String) 設定的所有檢測引數。
getApkFileName
public String getApkFileName ()
傳回 APK 安裝作業的 APK 檔案名稱。
| 傳回 | |
|---|---|
String |
|
getExtraListeners
publicgetExtraListeners ()
| 傳回 | |
|---|---|
|
|
getInstallArgs
public String[] getInstallArgs ()
傳回安裝指令的額外選項。
| 傳回 | |
|---|---|
String[] |
|
getInstrumentationArgs
publicgetInstrumentationArgs ()
| 傳回 | |
|---|---|
|
|
getMaxInstrumentationTimeoutMs
public Long getMaxInstrumentationTimeoutMs ()
| 傳回 | |
|---|---|
Long |
|
getMaxTimeToOutputMs
public Long getMaxTimeToOutputMs ()
| 傳回 | |
|---|---|
Long |
|
getPackageName
public String getPackageName ()
| 傳回 | |
|---|---|
String |
|
getRunner
public String getRunner ()
| 傳回 | |
|---|---|
String |
|
getTestClassName
public String getTestClassName ()
| 傳回 | |
|---|---|
String |
|
getTestMethodName
public String getTestMethodName ()
| 傳回 | |
|---|---|
String |
|
getTestTimeoutMs
public Long getTestTimeoutMs ()
| 傳回 | |
|---|---|
Long |
|
getUserId
public Integer getUserId ()
| 傳回 | |
|---|---|
Integer |
|
isForceQueryable
public boolean isForceQueryable ()
是否應可查詢要安裝的 APK。預設值為 true。
| 傳回 | |
|---|---|
boolean |
|
isGrantPermission
public boolean isGrantPermission ()
是否要授予 APK 安裝權限。
| 傳回 | |
|---|---|
boolean |
|
isHiddenApiCheckDisabled
public boolean isHiddenApiCheckDisabled ()
| 傳回 | |
|---|---|
boolean |
|
isIsolatedStorageDisabled
public boolean isIsolatedStorageDisabled ()
| 傳回 | |
|---|---|
boolean |
|
isRestartDisabled
public boolean isRestartDisabled ()
| 傳回 | |
|---|---|
boolean |
|
isTestApiCheckDisabled
public boolean isTestApiCheckDisabled ()
| 傳回 | |
|---|---|
boolean |
|
isWindowAnimationDisabled
public boolean isWindowAnimationDisabled ()
| 傳回 | |
|---|---|
boolean |
|
setApkFileName
public DeviceTestRunOptions setApkFileName (String apkFileName)
設定 APK 安裝作業的 APK 檔案名稱。
| 參數 | |
|---|---|
apkFileName |
String |
| 傳回 | |
|---|---|
DeviceTestRunOptions |
|
setCheckResults
public DeviceTestRunOptions setCheckResults (boolean checkResults)
設定是否應檢查檢測執行結果,並確保不會發生失敗。
| 參數 | |
|---|---|
checkResults |
boolean |
| 傳回 | |
|---|---|
DeviceTestRunOptions |
|
setDevice
public DeviceTestRunOptions setDevice (ITestDevice device)
| 參數 | |
|---|---|
device |
ITestDevice |
| 傳回 | |
|---|---|
DeviceTestRunOptions |
|
setDisableHiddenApiCheck
public DeviceTestRunOptions setDisableHiddenApiCheck (boolean disableHiddenApiCheck)
設定是否要將 --no-hidden-api-checks 新增至主機端使用的「am 檢測工具」。
| 參數 | |
|---|---|
disableHiddenApiCheck |
boolean |
| 傳回 | |
|---|---|
DeviceTestRunOptions |
|
setDisableIsolatedStorage
public DeviceTestRunOptions setDisableIsolatedStorage (boolean disableIsolatedStorage)
設定是否要將 --no-isolated-storage 新增至主機端使用的「am 指標」。
| 參數 | |
|---|---|
disableIsolatedStorage |
boolean |
| 傳回 | |
|---|---|
DeviceTestRunOptions |
|
setDisableRestart
public DeviceTestRunOptions setDisableRestart (boolean disableRestart)
設定是否要將 --no-restart 新增至主機端使用的「am 指標」。
| 參數 | |
|---|---|
disableRestart |
boolean |
| 傳回 | |
|---|---|
DeviceTestRunOptions |
|
setDisableTestApiCheck
public DeviceTestRunOptions setDisableTestApiCheck (boolean disableTestApiCheck)
設定是否要將 --no-test-api-access 新增至主機端使用的「am 檢測工具」。
| 參數 | |
|---|---|
disableTestApiCheck |
boolean |
| 傳回 | |
|---|---|
DeviceTestRunOptions |
|
setDisableWindowAnimation
public DeviceTestRunOptions setDisableWindowAnimation (boolean disableWindowAnimation)
設定是否要將 --no-window-animation 新增至主機端使用的「am 指標」。
| 參數 | |
|---|---|
disableWindowAnimation |
boolean |
| 傳回 | |
|---|---|
DeviceTestRunOptions |
|
setForceQueryable
public DeviceTestRunOptions setForceQueryable (boolean forceQueryable)
如果要安裝的 APK 不應可供查詢,就會設定 false。
| 參數 | |
|---|---|
forceQueryable |
boolean |
| 傳回 | |
|---|---|
DeviceTestRunOptions |
|
setGrantPermission
public DeviceTestRunOptions setGrantPermission (boolean grantPermission)
授予 APK 安裝權限。
| 參數 | |
|---|---|
grantPermission |
boolean |
| 傳回 | |
|---|---|
DeviceTestRunOptions |
|
setInstallArgs
public DeviceTestRunOptions setInstallArgs (String... installArgs)
設定安裝指令的額外選項。
| 參數 | |
|---|---|
installArgs |
String |
| 傳回 | |
|---|---|
DeviceTestRunOptions |
|
setMaxInstrumentationTimeoutMs
public DeviceTestRunOptions setMaxInstrumentationTimeoutMs (Long maxInstrumentationTimeoutMs)
設定完整檢測作業必須執行和完成的時間上限 (以毫秒為單位)。設為 0 可關閉逾時機制。選用項目。
| 參數 | |
|---|---|
maxInstrumentationTimeoutMs |
Long |
| 傳回 | |
|---|---|
DeviceTestRunOptions |
|
setMaxTimeToOutputMs
public DeviceTestRunOptions setMaxTimeToOutputMs (Long maxTimeToOutputMs)
設定檢測工具停止輸出前可輸出內容的時間上限 (以毫秒為單位)。設為 0 可關閉逾時機制。選用項目。
| 參數 | |
|---|---|
maxTimeToOutputMs |
Long |
| 傳回 | |
|---|---|
DeviceTestRunOptions |
|
setRunner
public DeviceTestRunOptions setRunner (String runner)
設定應用於執行檢測功能的檢測功能執行程式。預設的執行程式為 'android.support.test.runner.AndroidJUnitRunner'。選用項目。
| 參數 | |
|---|---|
runner |
String |
| 傳回 | |
|---|---|
DeviceTestRunOptions |
|
setTestClassName
public DeviceTestRunOptions setTestClassName (String testClassName)
設定檢測工具應執行的類別名稱。系統會篩選檢測工具,只執行該類別。可與 setTestMethodName(String) 搭配使用。選用項目。
| 參數 | |
|---|---|
testClassName |
String |
| 傳回 | |
|---|---|
DeviceTestRunOptions |
|
setTestMethodName
public DeviceTestRunOptions setTestMethodName (String testMethodName)
設定檢測工具應執行的方法名稱。必須設定 setTestClassName(String),才能正常運作。選用項目。
| 參數 | |
|---|---|
testMethodName |
String |
| 傳回 | |
|---|---|
DeviceTestRunOptions |
|
setTestTimeoutMs
public DeviceTestRunOptions setTestTimeoutMs (Long testTimeoutMs)
設定測試可執行的最大時間 (以毫秒為單位),超過時間就會中斷。設為 0 可無限延遲。選用項目。
| 參數 | |
|---|---|
testTimeoutMs |
Long |
| 傳回 | |
|---|---|
DeviceTestRunOptions |
|
setUserId
public DeviceTestRunOptions setUserId (Integer userId)
設定檢測工具應執行的使用者 ID。選用項目。
| 參數 | |
|---|---|
userId |
Integer |
| 傳回 | |
|---|---|
DeviceTestRunOptions |
|
shouldCheckResults
public boolean shouldCheckResults ()
| 傳回 | |
|---|---|
boolean |
|