ILogSaverListener
public
interface
ILogSaverListener
implements
ITestInvocationListener
| com.android.tradefed.result.ILogSaverListener |
允许 ITestInvocationListener 监听日志文件保存的时间。
这样,多个 ITestInvocationListener 在生成报告时就可以使用相同的已保存日志文件,从而避免在调用 ITestLogger.testLog(String, com.android.tradefed.result.LogDataType, com.android.tradefed.result.InputStreamSource) 时每个监听器都单独保存文件。
实现此接口的类应注意,每当调用 ITestLogger.testLog(String, com.android.tradefed.result.LogDataType, com.android.tradefed.result.InputStreamSource) 时,系统都会调用 testLogSaved(String, com.android.tradefed.result.LogDataType, com.android.tradefed.result.InputStreamSource, com.android.tradefed.result.LogFile)。
此类还会传递全局 ILogSaver 实例,以便 ITestInvocationListener 能够在同一位置保存其他文件。
摘要
公共方法 | |
|---|---|
default
void
|
logAssociation(String dataName, LogFile logFile)
在某些情况下,日志必须与测试用例强相关联,但无法在直接 |
default
void
|
setLogSaver(ILogSaver logSaver)
设置 |
default
void
|
testLogSaved(String dataName, LogDataType dataType, InputStreamSource dataStream, LogFile logFile)
在保存测试日志时调用。 |
公共方法
logAssociation
public void logAssociation (String dataName,
LogFile logFile)在某些情况下,日志必须与测试用例强相关联,但无法在直接 testLogSaved(String, com.android.tradefed.result.LogDataType, com.android.tradefed.result.InputStreamSource, com.android.tradefed.result.LogFile) 回调中执行此操作。因此,此回调允许显式提供强关联。
| 参数 | |
|---|---|
dataName |
String:数据的名称 |
logFile |
LogFile:之前记录的 LogFile,应与测试用例相关联。 |
setLogSaver
public void setLogSaver (ILogSaver logSaver)
设置 ILogSaver 以允许实现者保存文件。
| 参数 | |
|---|---|
logSaver |
ILogSaver:ILogSaver |
testLogSaved
public void testLogSaved (String dataName,
LogDataType dataType,
InputStreamSource dataStream,
LogFile logFile)在保存测试日志时调用。
应改为使用 ITestInvocationListener.testLog(String, LogDataType,
InputStreamSource)。
| 参数 | |
|---|---|
dataName |
String:数据的 String 描述性名称,例如“device_logcat”。注意:每次调用时,dataName 可能不唯一。即,实现者必须能够处理具有相同 dataName 的多次调用 |
dataType |
LogDataType:数据的 LogDataType |
dataStream |
InputStreamSource:数据的 InputStreamSource。实现人员应调用 createInputStream 以开始读取数据,并确保在完成后关闭生成的 InputStream。 |
logFile |
LogFile:包含已保存文件的元数据的 LogFile。 |