設備測試運行選項
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 Instrument」。 |
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 () |
公共構造函數
設備測試運行選項
public DeviceTestRunOptions (String packageName)
參數 | |
---|---|
packageName | String |
公共方法
新增額外監聽器
public DeviceTestRunOptions addExtraListener (ITestLifeCycleReceiver listener)
在正在運行的檢測中新增一個額外的偵聽器。
參數 | |
---|---|
listener | ITestLifeCycleReceiver |
退貨 | |
---|---|
DeviceTestRunOptions |
添加InstrumentationArg
public DeviceTestRunOptions addInstrumentationArg (String key, String value)
新增將傳遞給檢測的參數。
參數 | |
---|---|
key | String |
value | String |
退貨 | |
---|---|
DeviceTestRunOptions |
清除額外監聽器
public void clearExtraListeners ()
取得Apk檔名
public String getApkFileName ()
傳回 apk 安裝的 apk 檔案的名稱。
退貨 | |
---|---|
String |
取得額外的監聽器
publicgetExtraListeners ()
退貨 | |
---|---|
取得安裝參數
public String[] getInstallArgs ()
返回安裝命令的額外選項。
退貨 | |
---|---|
String[] |
取得儀器參數
publicgetInstrumentationArgs ()
退貨 | |
---|---|
getMaxInstrumentationTimeoutMs
public Long getMaxInstrumentationTimeoutMs ()
退貨 | |
---|---|
Long |
取得最大輸出時間
public Long getMaxTimeToOutputMs ()
退貨 | |
---|---|
Long |
取得包名
public String getPackageName ()
退貨 | |
---|---|
String |
獲取亞軍
public String getRunner ()
退貨 | |
---|---|
String |
取得測試類別名
public String getTestClassName ()
退貨 | |
---|---|
String |
取得測試方法名稱
public String getTestMethodName ()
退貨 | |
---|---|
String |
取得測試超時時間
public Long getTestTimeoutMs ()
退貨 | |
---|---|
Long |
取得用戶ID
public Integer getUserId ()
退貨 | |
---|---|
Integer |
isForceQueryable
public boolean isForceQueryable ()
要安裝的apk是否應該是可查詢的。預設值是true。
退貨 | |
---|---|
boolean |
是否授予權限
public boolean isGrantPermission ()
是否授予apk安裝權限。
退貨 | |
---|---|
boolean |
isHiddenApiCheckDisabled
public boolean isHiddenApiCheckDisabled ()
退貨 | |
---|---|
boolean |
已停用隔離存儲
public boolean isIsolatedStorageDisabled ()
退貨 | |
---|---|
boolean |
是否重新啟動已停用
public boolean isRestartDisabled ()
退貨 | |
---|---|
boolean |
isTestApiCheckDisabled
public boolean isTestApiCheckDisabled ()
退貨 | |
---|---|
boolean |
isWindowAnimationDisabled
public boolean isWindowAnimationDisabled ()
退貨 | |
---|---|
boolean |
設定Apk檔名
public DeviceTestRunOptions setApkFileName (String apkFileName)
設定 apk 安裝的 apk 檔案的名稱。
參數 | |
---|---|
apkFileName | String |
退貨 | |
---|---|
DeviceTestRunOptions |
設定檢查結果
public DeviceTestRunOptions setCheckResults (boolean checkResults)
設定是否應檢查儀器運作的結果並確保不會發生故障。
參數 | |
---|---|
checkResults | boolean |
退貨 | |
---|---|
DeviceTestRunOptions |
設定設備
public DeviceTestRunOptions setDevice (ITestDevice device)
參數 | |
---|---|
device | ITestDevice |
退貨 | |
---|---|
DeviceTestRunOptions |
設定禁用HiddenApiCheck
public DeviceTestRunOptions setDisableHiddenApiCheck (boolean disableHiddenApiCheck)
設定是否將 --no-hidden-api-checks 新增至主機端使用的「am 工具」。
參數 | |
---|---|
disableHiddenApiCheck | boolean |
退貨 | |
---|---|
DeviceTestRunOptions |
設定禁用隔離存儲
public DeviceTestRunOptions setDisableIsolatedStorage (boolean disableIsolatedStorage)
設定是否將 --no-isolated-storage 新增到主機端使用的「am 儀器」。
參數 | |
---|---|
disableIsolatedStorage | boolean |
退貨 | |
---|---|
DeviceTestRunOptions |
設定禁用重啟
public DeviceTestRunOptions setDisableRestart (boolean disableRestart)
設定是否將 --no-restart 新增至從主機端使用的「am Instrument」。
參數 | |
---|---|
disableRestart | boolean |
退貨 | |
---|---|
DeviceTestRunOptions |
設定禁用TestApiCheck
public DeviceTestRunOptions setDisableTestApiCheck (boolean disableTestApiCheck)
設定是否將 --no-test-api-access 新增至主機端使用的「am 儀器」。
參數 | |
---|---|
disableTestApiCheck | boolean |
退貨 | |
---|---|
DeviceTestRunOptions |
設定禁用視窗動畫
public DeviceTestRunOptions setDisableWindowAnimation (boolean disableWindowAnimation)
設定是否將 --no-window-animation 新增至主機端所使用的「am 樂器」。
參數 | |
---|---|
disableWindowAnimation | boolean |
退貨 | |
---|---|
DeviceTestRunOptions |
設定強制可查詢
public DeviceTestRunOptions setForceQueryable (boolean forceQueryable)
如果要安裝的 apk 不可查詢,則設定false
。
參數 | |
---|---|
forceQueryable | boolean |
退貨 | |
---|---|
DeviceTestRunOptions |
設定授予權限
public DeviceTestRunOptions setGrantPermission (boolean grantPermission)
授予 apk 安裝權限。
參數 | |
---|---|
grantPermission | boolean |
退貨 | |
---|---|
DeviceTestRunOptions |
設定安裝參數
public DeviceTestRunOptions setInstallArgs (String... installArgs)
設定安裝命令的額外選項。
參數 | |
---|---|
installArgs | String |
退貨 | |
---|---|
DeviceTestRunOptions |
setMaxInstrumentationTimeoutMs
public DeviceTestRunOptions setMaxInstrumentationTimeoutMs (Long maxInstrumentationTimeoutMs)
設定完整檢測必須運行和完成的最長時間(以毫秒為單位)。設定為 0 表示無逾時。選修的。
參數 | |
---|---|
maxInstrumentationTimeoutMs | Long |
退貨 | |
---|---|
DeviceTestRunOptions |
設定最大輸出時間
public DeviceTestRunOptions setMaxTimeToOutputMs (Long maxTimeToOutputMs)
設定儀器在停止之前可以停止輸出的最長時間(以毫秒為單位)。設定為 0 表示無逾時。選修的。
參數 | |
---|---|
maxTimeToOutputMs | Long |
退貨 | |
---|---|
DeviceTestRunOptions |
設定運行器
public DeviceTestRunOptions setRunner (String runner)
設定應用於運行檢測的檢測運行器。預設運行程式是“android.support.test.runner.AndroidJUnitRunner”。選修的。
參數 | |
---|---|
runner | String |
退貨 | |
---|---|
DeviceTestRunOptions |
設定測試類別名
public DeviceTestRunOptions setTestClassName (String testClassName)
設定檢測應運行的類別名稱。儀器將被過濾為僅運行該類別。可以與setTestMethodName(String)
一起使用。選修的。
參數 | |
---|---|
testClassName | String |
退貨 | |
---|---|
DeviceTestRunOptions |
設定測試方法名稱
public DeviceTestRunOptions setTestMethodName (String testMethodName)
設定檢測應運行的方法名稱。需要設定setTestClassName(String)
才能正常運作。選修的。
參數 | |
---|---|
testMethodName | String |
退貨 | |
---|---|
DeviceTestRunOptions |
設定測試超時時間
public DeviceTestRunOptions setTestTimeoutMs (Long testTimeoutMs)
設定測試在中斷之前可以運行的最長時間(以毫秒為單位)。設定為 0 表示無逾時。選修的。
參數 | |
---|---|
testTimeoutMs | Long |
退貨 | |
---|---|
DeviceTestRunOptions |
設定用戶ID
public DeviceTestRunOptions setUserId (Integer userId)
設定應運行檢測的使用者 ID。選修的。
參數 | |
---|---|
userId | Integer |
退貨 | |
---|---|
DeviceTestRunOptions |
應該檢查結果
public boolean shouldCheckResults ()
退貨 | |
---|---|
boolean |