TestInvocation
public
class
TestInvocation
extends Object
implements
ITestInvocation
| java.lang.Object | |
| ↳ | com.android.tradefed.invoker.TestInvocation |
ITestInvocation 的預設實作。
根據 IConfiguration 載入主要物件
- 擷取建構版本
- 準備目標
- 執行測試
- 報告結果
摘要
常數 | |
|---|---|
long |
AVAILABILITY_CHECK_TIMEOUT
|
String |
COMMAND_ARGS_KEY
指令列引數屬性的鍵 |
String |
INVOCATION_EXTERNAL_DEPENDENCIES
|
String |
TRADEFED_CONFIG_NAME
|
String |
TRADEFED_END_HOST_LOG
|
String |
TRADEFED_INVOC_COMPLETE_HOST_LOG
|
String |
TRADEFED_LOG_NAME
|
公用建構函式 | |
|---|---|
TestInvocation()
|
|
公用方法 | |
|---|---|
static
IBuildInfo
|
backFillBuildInfoForReporting(String commandLine)
這個輔助程式會使用指令列,在下載失敗時填補 |
static
FailureDescription
|
createFailureFromException(Throwable exception, TestRecordProto.FailureStatus defaultStatus)
從叫用例外狀況建立 |
IInvocationExecution
|
createInvocationExec(TestInvocation.RunMode mode)
建立應遵循的叫用路徑。 |
static
String
|
getDeviceLogName(TestInvocation.Stage stage)
|
static
String
|
getEmulatorLogName(TestInvocation.Stage stage)
|
ITestInvocation.ExitInformation
|
getExitInfo()
指定調用的結束資訊。 |
void
|
invoke(IInvocationContext context, IConfiguration config, IRescheduler rescheduler, ITestInvocationListener... extraListeners)
執行測試呼叫。 |
static
boolean
|
isSubprocess(IConfiguration config)
如果目前在子程序範圍內叫用,則傳回 true。 |
void
|
notifyInvocationForceStopped(String message, ErrorIdentifier errorId)
通知 |
void
|
notifyInvocationStopped(String message)
通知 |
static
void
|
printStageDelimiter(TestInvocation.Stage phase, boolean end)
為指定呼叫階段列印分隔符號。 |
void
|
registerExecutionFiles(ExecutionFiles executionFiles)
|
void
|
setClearcutClient(ClearcutClient client)
轉送 clearcut 用戶端來回報指標。 |
static
boolean
|
shouldSkipBugreportError(Throwable t)
Helper method that identifies errors when the bugreport should be skipped |
String
|
toString()
|
受保護的方法 | |
|---|---|
void
|
addInvocationMetric(InvocationMetricLogger.InvocationMetricKey key, String value)
|
void
|
addInvocationMetric(InvocationMetricLogger.InvocationMetricKey key, long value)
|
void
|
applyAutomatedReporters(IConfiguration config)
|
void
|
setExitCode(CommandRunner.ExitCode code, Throwable stack)
Helper to set the exit code. |
常數
AVAILABILITY_CHECK_TIMEOUT
public static final long AVAILABILITY_CHECK_TIMEOUT
常數值: 180000 (0x000000000002bf20)
COMMAND_ARGS_KEY
public static final String COMMAND_ARGS_KEY
指令列引數屬性的鍵
常數值: "command_line_args"
INVOCATION_EXTERNAL_DEPENDENCIES
public static final String INVOCATION_EXTERNAL_DEPENDENCIES
常數值: "invocation-external-dependencies"
TRADEFED_CONFIG_NAME
public static final String TRADEFED_CONFIG_NAME
常數值: "tradefed-expanded-config"
TRADEFED_END_HOST_LOG
public static final String TRADEFED_END_HOST_LOG
常數值: "end_host_log"
TRADEFED_INVOC_COMPLETE_HOST_LOG
public static final String TRADEFED_INVOC_COMPLETE_HOST_LOG
常數值: "invoc_complete_host_log"
TRADEFED_LOG_NAME
public static final String TRADEFED_LOG_NAME
常數值: "host_log"
公用建構函式
TestInvocation
public TestInvocation ()
公用方法
backFillBuildInfoForReporting
public static IBuildInfo backFillBuildInfoForReporting (String commandLine)
如果下載失敗,這個輔助程式會使用指令列,為報表填回 IBuildInfo。
| 參數 | |
|---|---|
commandLine |
String |
| 傳回 | |
|---|---|
IBuildInfo |
|
createFailureFromException
public static FailureDescription createFailureFromException (Throwable exception, TestRecordProto.FailureStatus defaultStatus)
從叫用例外狀況建立 FailureDescription。
| 參數 | |
|---|---|
exception |
Throwable:要轉換的例外狀況 |
defaultStatus |
TestRecordProto.FailureStatus:如果例外狀況不是 IHarnessException,預設使用的狀態。 |
| 傳回 | |
|---|---|
FailureDescription |
|
createInvocationExec
public IInvocationExecution createInvocationExec (TestInvocation.RunMode mode)
建立應遵循的叫用路徑。
| 參數 | |
|---|---|
mode |
TestInvocation.RunMode:目前執行的模式。 |
| 傳回 | |
|---|---|
IInvocationExecution |
描述呼叫的 IInvocationExecution。 |
getDeviceLogName
public static String getDeviceLogName (TestInvocation.Stage stage)
| 參數 | |
|---|---|
stage |
TestInvocation.Stage |
| 傳回 | |
|---|---|
String |
|
getEmulatorLogName
public static String getEmulatorLogName (TestInvocation.Stage stage)
| 參數 | |
|---|---|
stage |
TestInvocation.Stage |
| 傳回 | |
|---|---|
String |
|
getExitInfo
public ITestInvocation.ExitInformation getExitInfo ()
指定調用的結束資訊。
| 傳回 | |
|---|---|
ITestInvocation.ExitInformation |
|
叫用
public void invoke (IInvocationContext context, IConfiguration config, IRescheduler rescheduler, ITestInvocationListener... extraListeners)
執行測試呼叫。
| 參數 | |
|---|---|
context |
IInvocationContext:執行測試的 IInvocationContext。 |
config |
IConfiguration:這次測試執行的 IConfiguration。 |
rescheduler |
IRescheduler:IRescheduler,用於重新安排在其他資源上執行的部分呼叫 |
extraListeners |
ITestInvocationListener:除了 config 中的電子郵件地址外,還要通知的電子郵件地址。ITestInvocationListener |
| 擲回 | |
|---|---|
DeviceNotAvailableException |
|
isSubprocess
public static boolean isSubprocess (IConfiguration config)
如果目前叫用位於子程序範圍內,則傳回 true。
| 參數 | |
|---|---|
config |
IConfiguration |
| 傳回 | |
|---|---|
boolean |
|
notifyInvocationForceStopped
public void notifyInvocationForceStopped (String message,
ErrorIdentifier errorId)通知 TestInvocation,TradeFed 已要求停止。
| 參數 | |
|---|---|
message |
String:與停止呼叫相關聯的訊息 |
errorId |
ErrorIdentifier:與強制停止相關聯的 ID |
notifyInvocationStopped
public void notifyInvocationStopped (String message)
通知 TestInvocation,TradeFed 最終會關閉。
| 參數 | |
|---|---|
message |
String:與停止呼叫相關聯的訊息 |
printStageDelimiter
public static void printStageDelimiter (TestInvocation.Stage phase, boolean end)
為指定呼叫階段列印分隔符號。
| 參數 | |
|---|---|
phase |
TestInvocation.Stage |
end |
boolean |
registerExecutionFiles
public void registerExecutionFiles (ExecutionFiles executionFiles)
| 參數 | |
|---|---|
executionFiles |
ExecutionFiles |
setClearcutClient
public void setClearcutClient (ClearcutClient client)
轉送 clearcut 用戶端來回報指標。
| 參數 | |
|---|---|
client |
ClearcutClient |
shouldSkipBugreportError
public static boolean shouldSkipBugreportError (Throwable t)
輔助方法,可識別應略過錯誤報告時的錯誤
| 參數 | |
|---|---|
t |
Throwable |
| 傳回 | |
|---|---|
boolean |
|
toString
public String toString ()
| 傳回 | |
|---|---|
String |
|
受保護的方法
addInvocationMetric
protected void addInvocationMetric (InvocationMetricLogger.InvocationMetricKey key, String value)
| 參數 | |
|---|---|
key |
InvocationMetricLogger.InvocationMetricKey |
value |
String |
addInvocationMetric
protected void addInvocationMetric (InvocationMetricLogger.InvocationMetricKey key, long value)
| 參數 | |
|---|---|
key |
InvocationMetricLogger.InvocationMetricKey |
value |
long |
applyAutomatedReporters
protected void applyAutomatedReporters (IConfiguration config)
| 參數 | |
|---|---|
config |
IConfiguration |
setExitCode
protected void setExitCode (CommandRunner.ExitCode code, Throwable stack)
設定結束代碼的輔助程式。公開測試。
| 參數 | |
|---|---|
code |
CommandRunner.ExitCode |
stack |
Throwable |