InvocationExecution
public
class
InvocationExecution
extends Object
implements
IInvocationExecution
java.lang.Object | |
↳ | com.android.tradefed.invoker.InvocationExecution |
描述所有叫用步驟的類別:建構下載、target_prep、執行測試、清理。可擴充覆寫某些步驟的預設行為。步驟的順序由 TestInvocation
決定。
摘要
欄位 | |
---|---|
public
static
final
String |
ADB_VERSION_KEY
|
public
static
final
String |
JAVA_CLASSPATH_KEY
|
public
static
final
String |
JAVA_VERSION_KEY
|
公用建構函式 | |
---|---|
InvocationExecution()
|
公用方法 | |
---|---|
void
|
cleanUpBuilds(IInvocationContext context, IConfiguration config)
執行 build_provider 清除步驟。 |
void
|
doCleanUp(IInvocationContext context, IConfiguration config, Throwable exception)
執行 target_preparer 和 multi_target_preparer 的 cleanUp 步驟。 |
void
|
doSetup(TestInformation testInfo, IConfiguration config, ITestLogger listener)
執行 target_preparer 和 multi_target_preparer 的 setUp 步驟。 |
void
|
doTeardown(TestInformation testInfo, IConfiguration config, ITestLogger logger, Throwable exception)
執行 target_preparer 和 multi_target_preparer 的拆卸步驟。 |
boolean
|
fetchBuild(TestInformation testInfo, IConfiguration config, IRescheduler rescheduler, ITestInvocationListener listener)
執行叫用動作的 build_provider 步驟。 |
void
|
reportLogs(ITestDevice device, ITestLogger listener, TestInvocation.Stage stage)
在叫用作業的不同階段回報部分裝置記錄。 |
void
|
runDevicePostInvocationTearDown(IInvocationContext context, IConfiguration config, Throwable exception)
針對叫用動作的每個裝置部分,呼叫 |
void
|
runDevicePreInvocationSetup(IInvocationContext context, IConfiguration config, ITestLogger logger)
|
void
|
runTests(TestInformation info, IConfiguration config, ITestInvocationListener listener)
執行測試。 |
boolean
|
shardConfig(IConfiguration config, TestInformation testInfo, IRescheduler rescheduler, ITestLogger logger)
嘗試將設定分割成子設定,以便重新排程,在多個資源上並行執行。 |
受保護的方法 | |
---|---|
void
|
collectAutoInfo(IConfiguration config, TestInformation info)
自動收集測試中主要裝置的部分資訊。 |
IShardHelper
|
createShardHelper()
建立要使用的 |
void
|
customizeDevicePreInvocation(IConfiguration config, IInvocationContext context)
在 preInvocationSetup 之前,先自訂部分裝置。 |
String
|
getAdbVersion()
傳回用於叫用的 ADB 版本。 |
|
getLabPreparersToRun(IConfiguration config, String deviceName)
擷取要在這個裝置上執行的實驗室準備工具清單。 |
|
getTargetPreparersToRun(IConfiguration config, String deviceName)
擷取要在這個裝置上執行的目標準備工具清單。 |
void
|
linkExternalDirs(IBuildInfo info, TestInformation testInfo)
|
void
|
logHostAdb(IConfiguration config, ITestLogger logger)
從 $TMPDIR/adb.$UID.log 收集記錄。 |
Throwable
|
runPreparersTearDown(TestInformation testInfo, ITestDevice device, String deviceName, int deviceIndex, ITestLogger logger, Throwable exception,
|
void
|
setTestTag(IBuildInfo info, IConfiguration config)
處理在建構資訊上設定測試標記。 |
欄位
ADB_VERSION_KEY
public static final String ADB_VERSION_KEY
JAVA_CLASSPATH_KEY
public static final String JAVA_CLASSPATH_KEY
JAVA_VERSION_KEY
public static final String JAVA_VERSION_KEY
公用建構函式
InvocationExecution
public InvocationExecution ()
公用方法
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 listener)
執行 target_preparer 和 multi_target_preparer 的 setUp 步驟。是否已完成所有裝置設定,以便執行測試。
參數 | |
---|---|
testInfo |
TestInformation :叫用作業的 TestInformation 。 |
config |
IConfiguration :這個測試執行作業的 IConfiguration 。 |
listener |
ITestLogger :ITestLogger 用於回報設定失敗記錄。 |
擲回 | |
---|---|
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 :測試執行時擲回的原始例外狀況。 |
fetchBuild
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 |
如果成功下載版本,則傳回 True,否則傳回 False。 |
擲回 | |
---|---|
BuildRetrievalError |
|
DeviceNotAvailableException |
reportLogs
public void reportLogs (ITestDevice device, ITestLogger listener, TestInvocation.Stage stage)
在叫用作業的不同階段回報部分裝置記錄。例如:logcat。
參數 | |
---|---|
device |
ITestDevice :要回報記錄的裝置。 |
listener |
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 。 |
擲回 | |
---|---|
DeviceNotAvailableException |
|
TargetSetupError |
runTests
public void runTests (TestInformation info, IConfiguration config, ITestInvocationListener listener)
執行測試。
參數 | |
---|---|
info |
TestInformation :用於執行測試的 TestInformation 。 |
config |
IConfiguration :要執行的 IConfiguration |
listener |
ITestInvocationListener :測試結果的 ITestInvocationListener |
shardConfig
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 |
如果測試已分割,則為 true。否則傳回 false |
受保護的方法
collectAutoInfo
protected void collectAutoInfo (IConfiguration config, TestInformation info)
自動收集測試中主要裝置的部分資訊。
參數 | |
---|---|
config |
IConfiguration |
info |
TestInformation |
擲回 | |
---|---|
DeviceNotAvailableException |
createShardHelper
protected IShardHelper createShardHelper ()
建立要使用的 IShardHelper
並傳回。
傳回 | |
---|---|
IShardHelper |
customizeDevicePreInvocation
protected void customizeDevicePreInvocation (IConfiguration config, IInvocationContext context)
在預先叫用設定之前,先自訂部分裝置。
參數 | |
---|---|
config |
IConfiguration :叫用作業的設定。 |
context |
IInvocationContext :目前的叫用內容。 |
getAdbVersion
protected String getAdbVersion ()
傳回用於叫用作業的 ADB 版本。
傳回 | |
---|---|
String |
getLabPreparersToRun
protectedgetLabPreparersToRun (IConfiguration config, String deviceName)
擷取要在這個裝置上執行的實驗室準備工具清單。
在沙箱類別中覆寫,限制實驗室準備工具在沙箱子項中執行
參數 | |
---|---|
config |
IConfiguration |
deviceName |
String |
傳回 | |
---|---|
|
getTargetPreparersToRun
protectedgetTargetPreparersToRun (IConfiguration config, String deviceName)
擷取要在這個裝置上執行的目標準備工具清單。
在沙箱類別中覆寫,限制實驗室準備工具在沙箱子項中執行
參數 | |
---|---|
config |
IConfiguration |
deviceName |
String |
傳回 | |
---|---|
|
linkExternalDirs
protected void linkExternalDirs (IBuildInfo info, TestInformation testInfo)
參數 | |
---|---|
info |
IBuildInfo |
testInfo |
TestInformation |
logHostAdb
protected void logHostAdb (IConfiguration config, ITestLogger logger)
從 $TMPDIR/adb.$UID.log 收集記錄。
參數 | |
---|---|
config |
IConfiguration |
logger |
ITestLogger |
runPreparersTearDown
protected Throwable runPreparersTearDown (TestInformation testInfo, ITestDevice device, String deviceName, int deviceIndex, ITestLogger logger, Throwable exception,preparersToRun, trackPreparersMap)
參數 | |
---|---|
testInfo |
TestInformation |
device |
ITestDevice |
deviceName |
String |
deviceIndex |
int |
logger |
ITestLogger |
exception |
Throwable |
preparersToRun |
|
trackPreparersMap |
|
傳回 | |
---|---|
Throwable |
setTestTag
protected void setTestTag (IBuildInfo info, IConfiguration config)
處理在建構資訊上設定測試標記。
參數 | |
---|---|
info |
IBuildInfo |
config |
IConfiguration |