设备测试运行选项

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 ()

清除之前使用addInstrumentationArg(String, String)设置的所有检测参数。

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 不可查询,则设置false

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 ()

清除仪表参数

public void clearInstrumentationArgs ()

清除之前使用addInstrumentationArg(String, String)设置的所有检测参数。

获取Apk文件名

public String getApkFileName ()

返回 apk 安装的 apk 文件的名称。

退货
String

获取设备

public ITestDevice getDevice ()

退货
ITestDevice

获取额外的监听器

public  getExtraListeners ()

退货

获取安装参数

public String[] getInstallArgs ()

返回安装命令的额外选项。

退货
String[]

获取仪器参数

public  getInstrumentationArgs ()

退货

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