LogcatCrashResultForwarder
public
class
LogcatCrashResultForwarder
extends ResultForwarder
| java.lang.Object | ||
| ↳ | com.android.tradefed.result.ResultForwarder | |
| ↳ | com.android.tradefed.result.LogcatCrashResultForwarder | |
特殊监听器:如果发生故障(检测进程崩溃),它会尝试从 logcat 中提取崩溃信息,并将其添加到与测试关联的故障消息中。
摘要
常量 | |
|---|---|
String |
ERROR_MESSAGE
当设备端出现问题时,检测功能会发出特殊错误消息。 |
String |
INCOMPLETE_MESSAGE
|
int |
MAX_NUMBER_CRASH
|
String |
SYSTEM_CRASH_MESSAGE
|
字段 | |
|---|---|
public
static
final
List<String> |
TIMEOUT_MESSAGES
|
公共构造函数 | |
|---|---|
LogcatCrashResultForwarder(ITestDevice device, ITestInvocationListener... listeners)
|
|
公共方法 | |
|---|---|
ITestDevice
|
getDevice()
|
void
|
setPackageName(String packageName)
|
void
|
testEnded(TestDescription test, long endTime, HashMap<String, MetricMeasurement.Metric> testMetrics)
此方法是 |
void
|
testFailed(TestDescription test, FailureDescription failure)
报告单个测试用例的失败情况。 |
void
|
testFailed(TestDescription test, String trace)
报告单个测试用例的失败情况。 |
void
|
testRunEnded(long elapsedTime, HashMap<String, MetricMeasurement.Metric> runMetrics)
报告测试运行结束。 |
void
|
testRunFailed(FailureDescription error)
报告测试运行因 |
void
|
testRunFailed(String errorMessage)
报告测试运行因严重错误而未能完成。 |
void
|
testStarted(TestDescription test, long startTime)
此方法是 |
常量
ERROR_MESSAGE
public static final String ERROR_MESSAGE
当设备端出现问题时,检测功能会发出特殊错误消息。
常量值: "Process crashed."
INCOMPLETE_MESSAGE
public static final String INCOMPLETE_MESSAGE
常量值: "Test run failed to complete"
MAX_NUMBER_CRASH
public static final int MAX_NUMBER_CRASH
常量值: 3 (0x00000003)
SYSTEM_CRASH_MESSAGE
public static final String SYSTEM_CRASH_MESSAGE
常量值: "System has crashed."
字段
TIMEOUT_MESSAGES
public static final List<String> TIMEOUT_MESSAGES
公共构造函数
LogcatCrashResultForwarder
public LogcatCrashResultForwarder (ITestDevice device, ITestInvocationListener... listeners)
| 参数 | |
|---|---|
device |
ITestDevice |
listeners |
ITestInvocationListener |
公共方法
setPackageName
public void setPackageName (String packageName)
| 参数 | |
|---|---|
packageName |
String |
testEnded
public void testEnded (TestDescription test, long endTime, HashMap<String, MetricMeasurement.Metric> testMetrics)
此方法是 testEnded(TestDescription,Map) 的替代方法,可用于直接指定结束时间
。与 testStarted(TestDescription,long) 结合使用,以进行准确测量。
| 参数 | |
|---|---|
test |
TestDescription:标识测试 |
endTime |
long:测试结束时间,通过 System.currentTimeMillis() 测量 |
testMetrics |
HashMap:发出的指标的 Map |
testFailed
public void testFailed (TestDescription test, FailureDescription failure)
报告单个测试用例的失败情况。
将在 testStarted 和 testEnded 之间调用。
| 参数 | |
|---|---|
test |
TestDescription:标识测试 |
failure |
FailureDescription:描述故障及其上下文的 FailureDescription。 |
testFailed
public void testFailed (TestDescription test, String trace)
报告单个测试用例的失败情况。
将在 testStarted 和 testEnded 之间调用。
| 参数 | |
|---|---|
test |
TestDescription:标识测试 |
trace |
String:故障的堆栈轨迹 |
testRunEnded
public void testRunEnded (long elapsedTime,
HashMap<String, MetricMeasurement.Metric> runMetrics)报告测试运行结束。FIXME:我们不能有两个具有不同类型的 Map<> 接口,因此 我们必须在此处使用 HashMap。
| 参数 | |
|---|---|
elapsedTime |
long:设备报告的经过时间,以毫秒为单位 |
runMetrics |
HashMap:在测试运行结束时报告的键值对,带有 Metric。 |
testRunFailed
public void testRunFailed (FailureDescription error)
报告测试运行因 FailureDescription 中描述的故障而未能完成。
| 参数 | |
|---|---|
error |
FailureDescription:描述故障及其上下文的 FailureDescription。 |
testRunFailed
public void testRunFailed (String errorMessage)
报告测试运行因严重错误而未能完成。
| 参数 | |
|---|---|
errorMessage |
String:描述运行失败原因的 String。 |
testStarted
public void testStarted (TestDescription test, long startTime)
此方法是 testStarted(TestDescription) 的替代方法,可用于指定测试的开始时间,并与 testEnded(TestDescription,long,Map) 结合使用,以进行准确测量。
| 参数 | |
|---|---|
test |
TestDescription:标识测试 |
startTime |
long:测试开始时间,通过 System.currentTimeMillis() 测量 |