ITargetPreparer

public interface ITargetPreparer
implements IDisableable

com.android.tradefed.targetprep.ITargetPreparer


為測試執行準備測試環境。

例如安裝軟體、調整測試環境設定、啟動目標等。

請注意,您可以在設定中指定多個 ITargetPreparer。建議每個 ITargetPreparer 清楚記錄預期的環境預先設定和設定後狀態。舉例來說,設定裝置以進行測試的 ITargetPreparer 必須在安裝軟體的 ITargetPreparer 之後執行。

摘要

公用方法

default void setUp(ITestDevice device, IBuildInfo buildInfo)

這個方法已淘汰, 請改用 setUp(TestInformation)

default void setUp(TestInformation testInformation)

執行測試的目標設定。

default void tearDown(TestInformation testInformation, Throwable e)

測試完成後,請執行目標清除/拆除作業。

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

這個方法已淘汰, 請改用 tearDown(TestInformation,Throwable)

公用方法

setUp

public void setUp (ITestDevice device, 
                IBuildInfo buildInfo)

這個方法已淘汰。
請改用 setUp(TestInformation)

執行測試的目標設定。

參數
device ITestDevice:要準備的 ITestDevice

buildInfo IBuildInfo:受測建構版本的相關資料。

擲回
DeviceNotAvailableException 如果裝置沒有回應
BuildError 如果發生與 BuildInfo 相關的錯誤
TargetSetupError 如果設定環境時發生嚴重錯誤

setUp

public void setUp (TestInformation testInformation)

執行測試的目標設定。

參數
testInformation TestInformation:叫用的 TestInformation

擲回
DeviceNotAvailableException 如果裝置沒有回應
BuildError 如果準備建構作業時發生錯誤
TargetSetupError 如果設定環境時發生嚴重錯誤

tearDown

public void tearDown (TestInformation testInformation, 
                Throwable e)

測試完成後,請執行目標清理/拆除作業。

參數
testInformation TestInformation:叫用的 TestInformation

e Throwable:如果呼叫以例外狀況結束,這會是在呼叫層級擷取的例外狀況。否則為 null

擲回
DeviceNotAvailableException 如果裝置沒有回應

tearDown

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

這個方法已淘汰。
請改用 tearDown(TestInformation,Throwable)

測試完成後,請執行目標清理/拆除作業。

參數
device ITestDevice:要準備的 ITestDevice

buildInfo IBuildInfo:受測建構版本的相關資料。

e Throwable:如果呼叫以例外狀況結束,這會是在呼叫層級擷取的例外狀況。否則為 null

擲回
DeviceNotAvailableException 如果裝置沒有回應