LogcatCrashResultForwarder

public class LogcatCrashResultForwarder
extends ResultForwarder

java.lang.Object
com.android.tradefed.result.ResultForwarder
com.android.tradefed.result.LogcatCrashResultForwarder


特殊侦听器:在失败(检测进程崩溃)时,它将尝试从 logcat 中提取崩溃并将其添加到与测试相关的失败消息中。

概括

常量

int MAX_NUMBER_CRASH

字段

public static final String ERROR_MESSAGE

当设备端出现问题时,仪器会发出特殊错误消息。

public static final String INCOMPLETE_MESSAGE

public static final String SYSTEM_CRASH_MESSAGE

public static final TIMEOUT_MESSAGES

公共构造函数

LogcatCrashResultForwarder ( ITestDevice device, ITestInvocationListener... listeners)

公共方法

ITestDevice getDevice ()
void setPackageName (String packageName)
void testEnded ( TestDescription test, long endTime, testMetrics) testEnded ( TestDescription test, long endTime, testMetrics)

ERROR(/#testEnded(com.android.tradefed.result.TestDescription,Map))的替代方法,我们可以在其中直接指定结束时间。

void testFailed ( TestDescription test, FailureDescription failure)

报告单个测试用例的失败。

void testFailed ( TestDescription test, String trace)

报告单个测试用例的失败。

void testRunEnded (long elapsedTime, runMetrics) testRunEnded (long elapsedTime, runMetrics)

报告测试运行结束。

void testRunFailed ( FailureDescription error)

由于FailureDescription描述的故障,报告测试运行未能完成。

void testRunFailed (String errorMessage)

报告测试运行由于致命错误而未能完成。

void testStarted ( TestDescription test, long startTime)

testStarted(com.android.tradefed.result.TestDescription)的替代方法,我们还指定测试何时开始,并结合ERROR(/#testEnded(com.android.tradefed.result.TestDescription,long,Map))进行准确测量.

常量

MAX_NUMBER_CRASH 次

public static final int MAX_NUMBER_CRASH

常量值:3 (0x00000003)

字段

错误信息

public static final String ERROR_MESSAGE

当设备端出现问题时,仪器会发出特殊错误消息。

INCOMPLETE_MESSAGE

public static final String INCOMPLETE_MESSAGE

SYSTEM_CRASH_MESSAGE

public static final String SYSTEM_CRASH_MESSAGE

超时消息

public static final  TIMEOUT_MESSAGES

公共构造函数

LogcatCrashResultForwarder

public LogcatCrashResultForwarder (ITestDevice device, 
                ITestInvocationListener... listeners)

参数
device ITestDevice

listeners ITestInvocationListener

公共方法

获取设备

public ITestDevice getDevice ()

退货
ITestDevice

设置包名

public void setPackageName (String packageName)

参数
packageName String

测试结束

public void testEnded (TestDescription test, 
                long endTime, 
                 testMetrics)

ERROR(/#testEnded(com.android.tradefed.result.TestDescription,Map))的替代方法,我们可以在其中直接指定结束时间。结合testStarted(com.android.tradefed.result.TestDescription, long)进行准确测量。

参数
test TestDescription :标识测试

endTime long :测试结束的时间,通过ERROR(/System#currentTimeMillis())测量

testMetrics : 发出的指标的ERROR(/Map)

测试失败

public void testFailed (TestDescription test, 
                FailureDescription failure)

报告单个测试用例的失败。

将在 testStarted 和 testEnded 之间调用。

参数
test TestDescription :标识测试

failure FailureDescription :描述故障及其上下文的FailureDescription

测试失败

public void testFailed (TestDescription test, 
                String trace)

报告单个测试用例的失败。

将在 testStarted 和 testEnded 之间调用。

参数
test TestDescription :标识测试

trace String :失败的堆栈跟踪

测试运行结束

public void testRunEnded (long elapsedTime, 
                 runMetrics)

报告测试运行结束。 FIXME: 我们不能有两个不同类型的 Map<> 接口,所以我们必须在这里使用 HashMap。

参数
elapsedTime long :设备报告经过的时间,以毫秒为单位

runMetrics :在测试运行结束时使用Metric报告的键值对。

测试运行失败

public void testRunFailed (FailureDescription error)

由于FailureDescription描述的故障,报告测试运行未能完成。

参数
error FailureDescription :描述故障及其上下文的FailureDescription

测试运行失败

public void testRunFailed (String errorMessage)

报告测试运行由于致命错误而未能完成。

参数
errorMessage String : ERROR(/String)描述运行失败的原因。

测试开始

public void testStarted (TestDescription test, 
                long startTime)

testStarted(com.android.tradefed.result.TestDescription)的替代方法,我们还指定测试何时开始,并结合ERROR(/#testEnded(com.android.tradefed.result.TestDescription,long,Map))进行准确测量.

参数
test TestDescription :标识测试

startTime long :测试开始的时间,通过ERROR(/System#currentTimeMillis())测量