TestInvocation
public
class
TestInvocation
extends Object
implements
ITestInvocation
| java.lang.Object | |
| ↳ | com.android.tradefed.invoker.TestInvocation |
ITestInvocation 的默认实现。
根据 IConfiguration 加载主要对象
- 检索 build
- 准备目标
- 运行测试
- 报告结果
摘要
常量 | |
|---|---|
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)
使用命令行回填 |
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)
辅助方法,用于在应跳过 bug 报告时识别错误 |
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 |
IRescheduler:IRescheduler,用于重新调度调用的部分,以便在其他资源上执行 |
extraListeners |
ITestInvocationListener:要通知的 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:与强制停止相关联的标识符 |
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)
用于在应跳过 bug 报告时识别错误的辅助方法
| 参数 | |
|---|---|
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 |