調用執行
public interface IInvocationExecution
com.android.tradefed.invoker.IInvocationExecution |
描述將作為調用的一部分完成的操作的接口。調用TestInvocation
本身確保調用的順序。
概括
公共方法 | |
---|---|
default void | cleanUpBuilds ( IInvocationContext context, IConfiguration config) 執行 build_provider 清理步驟。 |
default void | doCleanUp ( IInvocationContext context, IConfiguration config, Throwable exception) 執行 target_preparer 和 multi_target_preparer 清理步驟。 |
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) 為調用的每個設備部分調用 |
default void | runDevicePreInvocationSetup ( IInvocationContext context, IConfiguration config, ITestLogger logger) |
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 清理步驟。設備是否清理。
參數 | |
---|---|
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 | IRescheduler : IRescheduler ,用於重新安排調用的一部分以在另一個資源上執行 |
listener | ITestInvocationListener :報告構建下載失敗的ITestInvocation 。 |
退貨 | |
---|---|
boolean | 如果我們成功下載構建,則為真,否則為假。 |
投擲 | |
---|---|
| 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 :我們所處的調用階段。 |
runDevicePostInvocationTearDown
public void runDevicePostInvocationTearDown (IInvocationContext context, IConfiguration config, Throwable exception)
為調用的每個設備部分調用ITestDevice#postInvocationTearDown(Throwable)
。
參數 | |
---|---|
context | IInvocationContext :調用的IInvocationContext 。 |
config | IConfiguration :本次測試運行的IConfiguration 。 |
exception | Throwable :測試運行時拋出的原始異常(如果有)。 |
runDevicePreInvocationSetup
public void runDevicePreInvocationSetup (IInvocationContext context, IConfiguration config, ITestLogger logger)
參數 | |
---|---|
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 | IRescheduler : IRescheduler 。 |
logger | ITestLogger : ITestLogger 用於在分片期間記錄文件。 |
退貨 | |
---|---|
boolean | 如果測試被分片則為真。否則返回false |