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 TIMEOUT_MESSAGES

公共构造函数

LogcatCrashResultForwarder(ITestDevice device, ITestInvocationListener... listeners)

公共方法

ITestDevice getDevice()
void setPackageName(String packageName)
void 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)

报告测试运行结束。

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)) 结合使用以实现精确衡量。

常量

ERROR_MESSAGE

public static final String ERROR_MESSAGE

当设备端出现问题时,来自插桩的特殊错误消息。

常量值: “进程崩溃。”

INCOMPLETE_MESSAGE

public static final String INCOMPLETE_MESSAGE

常量值: “测试运行未能完成”

MAX_NUMBER_CRASH

public static final int MAX_NUMBER_CRASH

常量值: 3 (0x00000003)

SYSTEM_CRASH_MESSAGE

public static final String SYSTEM_CRASH_MESSAGE

常量值: “系统已崩溃。”

字段

TIMEOUT_MESSAGES

public static final  TIMEOUT_MESSAGES

公共构造函数

LogcatCrashResultForwarder

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

参数
device ITestDevice

listeners ITestInvocationListener

公共方法

getDevice

public ITestDevice getDevice ()

返回
ITestDevice

setPackageName

public void setPackageName (String packageName)

参数
packageName String

testEnded

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)

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, 
                 runMetrics)

报告测试运行结束。

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

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

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(com.android.tradefed.result.TestDescription) 的替代方案,其中还指定了测试的开始时间,并与 ERROR(/#testEnded(com.android.tradefed.result.TestDescription,long,Map)) 结合使用以实现精确衡量。

参数
test TestDescription:用于标识测试

startTime long:测试开始时间,通过 System.currentTimeMillis() 测量