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()
|
List<ITestLifeCycleReceiver>
|
getExtraListeners()
|
String[]
|
getInstallArgs()
返回安装命令的额外选项。 |
Map<String, String>
|
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
|
isInstrumentInPcc()
是否将 --instrument-in-pcc 添加到从主机端使用的“am instrument”。 |
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 instrument”。 |
DeviceTestRunOptions
|
setDisableIsolatedStorage(boolean disableIsolatedStorage)
设置是否将 --no-isolated-storage 添加到从主机端使用的“am instrument”。 |
DeviceTestRunOptions
|
setDisableRestart(boolean disableRestart)
设置是否将 --no-restart 添加到从主机端使用的“am instrument”。 |
DeviceTestRunOptions
|
setDisableTestApiCheck(boolean disableTestApiCheck)
设置是否将 --no-test-api-access 添加到从主机端使用的“am instrument”。 |
DeviceTestRunOptions
|
setDisableWindowAnimation(boolean disableWindowAnimation)
设置是否将 --no-window-animation 添加到从主机端使用的“am instrument”。 |
DeviceTestRunOptions
|
setForceQueryable(boolean forceQueryable)
如果待安装的 APK 不应可查询,则设置 |
DeviceTestRunOptions
|
setGrantPermission(boolean grantPermission)
授予 APK 安装权限。 |
DeviceTestRunOptions
|
setInstallArgs(String... installArgs)
设置安装命令的额外选项。 |
DeviceTestRunOptions
|
setInstrumentInPcc(boolean instrumentInPcc)
设置是否将 --instrument-in-pcc 添加到从主机端使用的“am instrument”。 |
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
public List<ITestLifeCycleReceiver> getExtraListeners ()
| 返回 | |
|---|---|
List<ITestLifeCycleReceiver> |
|
getInstallArgs
public String[] getInstallArgs ()
返回安装命令的额外选项。
| 返回 | |
|---|---|
String[] |
|
getInstrumentationArgs
public Map<String, String> getInstrumentationArgs ()
| 返回 | |
|---|---|
Map<String, String> |
|
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 |
|
isInstrumentInPcc
public boolean isInstrumentInPcc ()
是否将 --instrument-in-pcc 添加到从宿主端使用的“am instrument”。
| 返回 | |
|---|---|
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 instrument”。
| 参数 | |
|---|---|
disableHiddenApiCheck |
boolean |
| 返回 | |
|---|---|
DeviceTestRunOptions |
|
setDisableIsolatedStorage
public DeviceTestRunOptions setDisableIsolatedStorage (boolean disableIsolatedStorage)
设置是否将 --no-isolated-storage 添加到从主机端使用的“am instrument”。
| 参数 | |
|---|---|
disableIsolatedStorage |
boolean |
| 返回 | |
|---|---|
DeviceTestRunOptions |
|
setDisableRestart
public DeviceTestRunOptions setDisableRestart (boolean disableRestart)
设置是否将 --no-restart 添加到从主机端使用的“am instrument”。
| 参数 | |
|---|---|
disableRestart |
boolean |
| 返回 | |
|---|---|
DeviceTestRunOptions |
|
setDisableTestApiCheck
public DeviceTestRunOptions setDisableTestApiCheck (boolean disableTestApiCheck)
设置是否将 --no-test-api-access 添加到从主机端使用的“am instrument”。
| 参数 | |
|---|---|
disableTestApiCheck |
boolean |
| 返回 | |
|---|---|
DeviceTestRunOptions |
|
setDisableWindowAnimation
public DeviceTestRunOptions setDisableWindowAnimation (boolean disableWindowAnimation)
设置是否将 --no-window-animation 添加到从主机端使用的“am instrument”。
| 参数 | |
|---|---|
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 |
|
setInstrumentInPcc
public DeviceTestRunOptions setInstrumentInPcc (boolean instrumentInPcc)
设置是否将 --instrument-in-pcc 添加到从主机端使用的“am instrument”。
| 参数 | |
|---|---|
instrumentInPcc |
boolean |
| 返回 | |
|---|---|
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 |
|