调用执行

public interface IInvocationExecution

com.android.tradefed.invoker.IInitationExecution


描述将作为调用的一部分完成的操作的接口。调用TestInvocation本身确保调用的顺序。

概括

公共方法

default void cleanUpBuilds ( IInvocationContext context, IConfiguration config)

执行 build_provider 清理步骤。

default void doCleanUp ( IInvocationContext context, IConfiguration config, Throwable exception)

执行 target_preparer 和 multi_target_preparer cleanUp 步骤。

default void doSetup ( TestInformation testInfo, IConfiguration config, ITestLogger logger)

执行 target_preparer 和 multi_target_preparer 设置步骤。

default void doTeardown ( TestInformation testInfo, IConfiguration config, ITestLogger logger, Throwable exception)

执行 target_preparer 和 multi_target_preparer 拆卸步骤。

default boolean fetchBuild ( TestInformation testInfo, IConfiguration config, IRescheduler rescheduler, ITestInvocationListener listener)

执行调用的 build_provider 步骤。

abstract void reportLogs ( ITestDevice device, ITestLogger logger, TestInvocation.Stage stage)

报告调用不同阶段的一些设备日志。

default void runDevicePostInvocationTearDown ( IInvocationContext context, IConfiguration config, Throwable exception)

为调用的每个设备部分调用ITestDevice#postInvocationTearDown(Throwable)

default void runDevicePreInvocationSetup ( IInvocationContext context, IConfiguration config, ITestLogger logger)

为调用的每个设备部分调用ERROR(ITestDevice#preInvocationSetup(IBuildInfo)/com.android.tradefed.device.ITestDevice#preInvocationSetup(com.android.tradefed.build.IBuildInfo) ITestDevice#preInvocationSetup(IBuildInfo))

default void runTests ( TestInformation info, IConfiguration config, ITestInvocationListener listener)

运行测试。

default boolean shardConfig ( IConfiguration config, TestInformation testInfo, IRescheduler rescheduler, ITestLogger logger)

尝试将配置分割为子配置,以便重新安排在多个资源上并行运行。

公共方法

清理构建

public void cleanUpBuilds (IInvocationContext context, 
                IConfiguration config)

执行 build_provider 清理步骤。与构建获取相关。

参数
context IInvocationContext :调用的IInvocationContext

config IConfiguration :本次测试运行的IConfiguration

清理

public void doCleanUp (IInvocationContext context, 
                IConfiguration config, 
                Throwable exception)

执行 target_preparer 和 multi_target_preparer cleanUp 步骤。设备是否清理干净。

参数
context IInvocationContext :调用的IInvocationContext

config IConfiguration :本次测试运行的IConfiguration

exception Throwable :测试运行时抛出的原始异常。

执行设置

public void doSetup (TestInformation testInfo, 
                IConfiguration config, 
                ITestLogger logger)

执行 target_preparer 和 multi_target_preparer 设置步骤。是否设置了运行测试所需的所有设备。

参数
testInfo TestInformation :调用的TestInformation

config IConfiguration :本次测试运行的IConfiguration

logger ITestLogger :报告设置失败日志的ITestLogger

投掷
com.android.tradefed.targetprep.TargetSetupError
com.android.tradefed.targetprep.BuildError
com.android.tradefed.device.DeviceNotAvailableException
BuildError
DeviceNotAvailableException
TargetSetupError

拆解

public void doTeardown (TestInformation testInfo, 
                IConfiguration config, 
                ITestLogger logger, 
                Throwable exception)

执行 target_preparer 和 multi_target_preparer 拆卸步骤。设备的拆卸是否与安装有关。

参数
testInfo TestInformation :调用的TestInformation

config IConfiguration :本次测试运行的IConfiguration

logger ITestLogger :报告日志的ITestLogger

exception Throwable :测试运行时抛出的原始异常。

投掷
可投掷

获取构建

public boolean fetchBuild (TestInformation testInfo, 
                IConfiguration config, 
                IRescheduler rescheduler, 
                ITestInvocationListener listener)

执行调用的 build_provider 步骤。

参数
testInfo TestInformation :调用的TestInformation

config IConfiguration :本次测试运行的IConfiguration

rescheduler IReschedulerIRescheduler ,用于重新安排调用的部分以便在另一个资源上执行

listener ITestInvocationListener :报告构建下载失败的ITestInvocation

退货
boolean如果我们成功下载了构建版本,则为 true,否则为 false。

投掷
com.android.tradefed.build.BuildRetrievalError
com.android.tradefed.device.DeviceNotAvailableException
BuildRetrievalError
DeviceNotAvailableException

报告日志

public abstract void reportLogs (ITestDevice device, 
                ITestLogger logger, 
                TestInvocation.Stage stage)

报告调用不同阶段的一些设备日志。例如:logcat。

参数
device ITestDevice :报告日志的设备。

logger ITestLogger :日志记录器。

stage TestInvocation.Stage :我们所处的调用阶段。

runDevicePostInspirationTearDown

public void runDevicePostInvocationTearDown (IInvocationContext context, 
                IConfiguration config, 
                Throwable exception)

为调用的每个设备部分调用ITestDevice#postInvocationTearDown(Throwable)

参数
context IInvocationContext :调用的IInvocationContext

config IConfiguration :本次测试运行的IConfiguration

exception Throwable :测试运行时抛出的原始异常(如果有)。

运行设备预调用设置

public void runDevicePreInvocationSetup (IInvocationContext context, 
                IConfiguration config, 
                ITestLogger logger)

为调用的每个设备部分调用ERROR(ITestDevice#preInvocationSetup(IBuildInfo)/com.android.tradefed.device.ITestDevice#preInvocationSetup(com.android.tradefed.build.IBuildInfo) ITestDevice#preInvocationSetup(IBuildInfo))

参数
context IInvocationContext :调用的IInvocationContext

config IConfiguration :本次测试运行的IConfiguration

logger ITestLogger :报告日志的ITestLogger

投掷
com.android.tradefed.device.DeviceNotAvailableException
com.android.tradefed.targetprep.TargetSetupError
DeviceNotAvailableException
TargetSetupError

运行测试

public void runTests (TestInformation info, 
                IConfiguration config, 
                ITestInvocationListener listener)

运行测试。

参数
info TestInformation :用于运行测试的TestInformation

config IConfiguration :要运行的IConfiguration

listener ITestInvocationListener :测试结果的ITestInvocationListener

投掷
可投掷

分片配置

public boolean shardConfig (IConfiguration config, 
                TestInformation testInfo, 
                IRescheduler rescheduler, 
                ITestLogger logger)

尝试将配置分割为子配置,以便重新安排在多个资源上并行运行。

如果分片计数大于 1,它将通过设置分片索引并重新安排它们来简单地为每个分片创建配置。如果未设置分片计数,它将回退到IShardHelper#shardConfig

参数
config IConfiguration :当前的IConfiguration

testInfo TestInformation :保存测试信息的TestInformation

rescheduler IReschedulerIRescheduler

logger ITestLoggerITestLogger用于在分片期间记录文件。

退货
boolean如果测试被分片则为 true。否则返回false