TestFailureListener
public
class
TestFailureListener
extends Object
implements
ITestInvocationListener
java.lang.Object | |
↳ | com.android.tradefed.testtype.suite.TestFailureListener |
监听器,用于在有请求时在测试失败时执行操作(例如截取屏幕截图、生成 bug 报告、收集 Logcat)。
摘要
公共构造函数 | |
---|---|
TestFailureListener(
|
公共方法 | |
---|---|
void
|
applyModuleConfiguration(boolean bugreportOnFailure)
允许通过模块专用配置替换失败时捕获的调用设置。 |
void
|
join()
加入所有 Logcat 捕获线程,以确保它们终止。 |
void
|
setLogger(ITestLogger logger)
设置日志的保存位置。 |
void
|
testFailed(TestDescription test, String trace)
|
void
|
testLog(String dataName, LogDataType dataType, InputStreamSource dataStream)
|
void
|
testLogForward(String dataName, LogDataType dataType, InputStreamSource dataStream)
将日志转发给日志记录器,请勿在 #testLog 回调中执行此操作,因为如果 TestFailureListener 是链的一部分,则会导致无限循环。 |
公共构造函数
TestFailureListener
public TestFailureListener (devices, boolean bugReportOnFailure, boolean rebootOnFailure)
参数 | |
---|---|
devices |
|
bugReportOnFailure |
boolean |
rebootOnFailure |
boolean |
公共方法
applyModuleConfiguration
public void applyModuleConfiguration (boolean bugreportOnFailure)
允许通过模块专用配置替换失败时捕获的调用设置。
参数 | |
---|---|
bugreportOnFailure |
boolean :如果为 true,则在测试失败时捕获 bug 报告。否则为 false。
|
join
public void join ()
加入所有 Logcat 捕获线程,以确保它们终止。
setLogger
public void setLogger (ITestLogger logger)
设置日志的保存位置。
参数 | |
---|---|
logger |
ITestLogger |
testFailed
public void testFailed (TestDescription test, String trace)
参数 | |
---|---|
test |
TestDescription |
trace |
String |
testLog
public void testLog (String dataName, LogDataType dataType, InputStreamSource dataStream)
参数 | |
---|---|
dataName |
String |
dataType |
LogDataType |
dataStream |
InputStreamSource |
testLogForward
public void testLogForward (String dataName, LogDataType dataType, InputStreamSource dataStream)
将日志转发给日志记录器,请勿在 #testLog 回调中执行此操作,因为如果 TestFailureListener 是链的一部分,则会导致无限循环。
参数 | |
---|---|
dataName |
String |
dataType |
LogDataType |
dataStream |
InputStreamSource |