IInvocationExecution

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 的 cleanUp 步驟。

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

執行 target_preparer 和 multi_target_preparer 的 setUp 步驟。

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)

嘗試將設定分割成子設定,以便重新排程,在多個資源上並行執行。

公用方法

cleanUpBuilds

public void cleanUpBuilds (IInvocationContext context, 
                IConfiguration config)

執行 build_provider 清除步驟。與建構擷取相關。

參數
context IInvocationContext:叫用作業的 IInvocationContext

config IConfiguration:這個測試執行作業的 IConfiguration

doCleanUp

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

執行 target_preparer 和 multi_target_preparer 的 cleanUp 步驟。裝置是否已清理乾淨。

參數
context IInvocationContext:叫用作業的 IInvocationContext

config IConfiguration:這個測試執行作業的 IConfiguration

exception Throwable:測試執行時擲回的原始例外狀況。

doSetup

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

執行 target_preparer 和 multi_target_preparer 的 setUp 步驟。是否已完成所有裝置設定,以便執行測試。

參數
testInfo TestInformation:叫用作業的 TestInformation

config IConfiguration:這個測試執行作業的 IConfiguration

logger ITestLoggerITestLogger 用於回報設定失敗記錄。

擲回
com.android.tradefed.targetprep.TargetSetupError
com.android.tradefed.targetprep.BuildError
com.android.tradefed.device.DeviceNotAvailableException
BuildError
DeviceNotAvailableException
TargetSetupError

doTeardown

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:測試執行時擲回的原始例外狀況。

擲回
Throwable

fetchBuild

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

reportLogs

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)

針對叫用動作的每個裝置部分呼叫 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

runTests

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

執行測試。

參數
info TestInformation:用於執行測試的 TestInformation

config IConfiguration:要執行的 IConfiguration

listener ITestInvocationListener:測試結果的 ITestInvocationListener

擲回
Throwable

shardConfig

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