测试失败监听器
public class TestFailureListener
extends Object
implements ITestInvocationListener
java.lang.Object | |
↳ | com.android.tradefed.testtype.suite.TestFailureListener |
侦听器用于在测试失败时根据请求采取操作,例如屏幕截图、错误报告、logcat 收集。
概括
公共构造函数 | |
---|---|
TestFailureListener ( devices, boolean bugReportOnFailure, boolean rebootOnFailure) TestFailureListener ( devices, boolean bugReportOnFailure, boolean rebootOnFailure) |
公共方法 | |
---|---|
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 是链的一部分一样,这将导致无限循环。 |
公共构造函数
测试失败监听器
public TestFailureListener (devices, boolean bugReportOnFailure, boolean rebootOnFailure)
参数 | |
---|---|
devices | |
bugReportOnFailure | boolean |
rebootOnFailure | boolean |
公共方法
应用模块配置
public void applyModuleConfiguration (boolean bugreportOnFailure)
允许通过模块特定配置覆盖失败时捕获的调用设置。
参数 | |
---|---|
bugreportOnFailure | boolean : true 捕获测试失败的错误报告。否则为假。 |
加入
public void join ()
加入所有 logcat 捕获线程以确保它们终止。
设置记录器
public void setLogger (ITestLogger logger)
设置日志的保存位置。
参数 | |
---|---|
logger | ITestLogger |
测试失败
public void testFailed (TestDescription test, String trace)
参数 | |
---|---|
test | TestDescription |
trace | String |
测试日志
public void testLog (String dataName, LogDataType dataType, InputStreamSource dataStream)
参数 | |
---|---|
dataName | String |
dataType | LogDataType |
dataStream | InputStreamSource |
测试日志转发
public void testLogForward (String dataName, LogDataType dataType, InputStreamSource dataStream)
将日志转发到记录器,不要从 #testLog 回调中执行此操作,就好像 TestFailureListener 是链的一部分一样,这将导致无限循环。
参数 | |
---|---|
dataName | String |
dataType | LogDataType |
dataStream | InputStreamSource |