TestInvocation

public class TestInvocation
extends Object implements ITestInvocation

java.lang.Object
   ↳ com.android.tradefed.invoker.TestInvocation


ITestInvocation 的預設實作。

根據 IConfiguration 載入主要物件 - 擷取版本 - 準備目標 - 執行測試 - 回報結果

摘要

常數

long AVAILABILITY_CHECK_TIMEOUT

欄位

public static final String COMMAND_ARGS_KEY

指令列引數屬性的索引鍵

public static final String INVOCATION_EXTERNAL_DEPENDENCIES

public static final String TRADEFED_CONFIG_NAME

public static final String TRADEFED_END_HOST_LOG

public static final String TRADEFED_INVOC_COMPLETE_HOST_LOG

public static final String TRADEFED_LOG_NAME

公用建構函式

TestInvocation()

公用方法

static IBuildInfo backFillBuildInfoForReporting(String commandLine)

使用指令列填補 IBuildInfo 的輔助程式,以便在下載失敗時回報。

static FailureDescription createFailureFromException(Throwable exception, TestRecordProto.FailureStatus defaultStatus)

從叫用例外狀況建立 FailureDescription

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)

通知 TestInvocation,TradeFed 已停止運作。

void notifyInvocationStopped(String message)

通知 TestInvocation 系統最終會關閉。

static void printStageDelimiter(TestInvocation.Stage phase, boolean end)

為叫用作業的特定階段列印分隔符。

void registerExecutionFiles(ExecutionFiles executionFiles)
void setClearcutClient(ClearcutClient client)

轉送 Clearcut 用戶端,以便回報指標。

static boolean shouldSkipBugreportError(Throwable t)

輔助程式方法,可在應略過 Bugreport 時識別錯誤

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)

設定結束碼的輔助程式。

常數

AVAILABILITY_CHECK_TIMEOUT

public static final long AVAILABILITY_CHECK_TIMEOUT

常數值: 180000 (0x000000000002bf20)

欄位

COMMAND_ARGS_KEY

public static final String COMMAND_ARGS_KEY

指令列引數屬性的索引鍵

INVOCATION_EXTERNAL_DEPENDENCIES

public static final String INVOCATION_EXTERNAL_DEPENDENCIES

TRADEFED_CONFIG_NAME

public static final String TRADEFED_CONFIG_NAME

TRADEFED_END_HOST_LOG

public static final String TRADEFED_END_HOST_LOG

TRADEFED_INVOC_COMPLETE_HOST_LOG

public static final String TRADEFED_INVOC_COMPLETE_HOST_LOG

TRADEFED_LOG_NAME

public static final String TRADEFED_LOG_NAME

公用建構函式

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 IReschedulerIRescheduler,用於重新排定部分呼叫,以便在其他資源上執行

extraListeners ITestInvocationListener:除了 config 中的 ITestInvocationListener 外,要通知的 ITestInvocationListener

擲回
DeviceNotAvailableException

isSubprocess

public static boolean isSubprocess (IConfiguration config)

如果叫用目前位於子程序範圍內,則傳回「是」。

參數
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)

輔助程式方法,可在應略過 Bugreport 時識別錯誤

參數
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