ITargetPreparer

public interface ITargetPreparer
implements IDisableable

com.android.tradefed.targetprep.ITargetPreparer


为运行测试的测试环境做好准备。

例如,安装软件、为测试调整环境设置、发布目标等。

请注意,可以在一个配置中指定多个 ITargetPreparer。时间是 建议每个 ITargetPreparer 清晰地记录其预期的环境预设置和 。例如配置要测试的设备的 ITargetPreparer 必须在 ITargetPreparer。

摘要

公共方法

default void setUp(ITestDevice device, IBuildInfo buildInfo)

此方法已被弃用。 改用 setUp(com.android.tradefed.invoker.TestInformation)

default void setUp(TestInformation testInformation)

执行目标设置以进行测试。

default void tearDown(TestInformation testInformation, Throwable e)

测试后执行目标清理/拆解。

default void tearDown(ITestDevice device, IBuildInfo buildInfo, Throwable e)

此方法已被弃用。 改用 tearDown(com.android.tradefed.invoker.TestInformation, Throwable)

公共方法

设置

public void setUp (ITestDevice device, 
                IBuildInfo buildInfo)

此方法已废弃。
改用 setUp(com.android.tradefed.invoker.TestInformation)

执行目标设置以进行测试。

参数
device ITestDevice:要准备的 ITestDevice

buildInfo IBuildInfo:被测 build 的相关数据。

抛出
TargetSetupError 设置环境发生严重错误时发出通知
BuildError 如果发生与 BuildInfo 相关的错误
DeviceNotAvailableException 如果设备无响应

设置

public void setUp (TestInformation testInformation)

执行目标设置以进行测试。

参数
testInformation TestInformation:调用的 TestInformation

抛出
TargetSetupError 设置环境发生严重错误时发出通知
BuildError 如果由于准备构建而发生错误
DeviceNotAvailableException 如果设备无响应

拆解

public void tearDown (TestInformation testInformation, 
                Throwable e)

测试后执行目标清理/拆解。

参数
testInformation TestInformation:调用的 TestInformation

e Throwable:如果调用因异常而结束,那么也就表示之前 是在调用级别捕获的。否则,将为 null

抛出
DeviceNotAvailableException 如果设备无响应

拆解

public void tearDown (ITestDevice device, 
                IBuildInfo buildInfo, 
                Throwable e)

此方法已废弃。
改用 tearDown(com.android.tradefed.invoker.TestInformation, Throwable)

测试后执行目标清理/拆解。

参数
device ITestDevice:要准备的 ITestDevice

buildInfo IBuildInfo:被测 build 的相关数据。

e Throwable:如果调用因异常而结束,那么也就表示之前 是在调用级别捕获的。否则,将为 null

抛出
DeviceNotAvailableException 如果设备无响应