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 :测试结束的时间,通过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 :描述运行失败原因的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 :测试开始的时间,通过System.currentTimeMillis()测量