LogSaverResultForwarder
public
class
LogSaverResultForwarder
extends ResultForwarder
implements
ILogSaverListener
java.lang.Object | ||
↳ | com.android.tradefed.result.ResultForwarder | |
↳ | com.android.tradefed.result.LogSaverResultForwarder |
用于使用全局文件保存程序保存日志的 ResultForwarder
。
摘要
公共构造函数 | |
---|---|
LogSaverResultForwarder(ILogSaver logSaver,
|
公共方法 | |
---|---|
void
|
invocationEnded(long elapsedTime)
报告调用已终止,无论是成功终止还是因某种错误条件而终止。 |
void
|
invocationStarted(IInvocationContext context)
报告测试调用的开始。 |
void
|
logAssociation(String dataName, LogFile logFile)
在某些情况下,日志必须与测试用例强相关联,但无法在直接 |
static
void
|
logFile(
在完成之前记录最终文件 |
static
void
|
reportEndHostLog(
报告正在进行的会话中的 host_log。 |
void
|
testLog(String dataName, LogDataType dataType, InputStreamSource dataStream)
提供测试调用中的关联日志或调试数据。
此外,使用全局 |
void
|
testLogForward(String dataName, LogDataType dataType, InputStreamSource dataStream)
仅转发 testLog,而不是先保存日志。 |
void
|
testLogSaved(String dataName, LogDataType dataType, InputStreamSource dataStream, LogFile logFile)
在保存测试日志时调用。 如果 |
公共构造函数
LogSaverResultForwarder
public LogSaverResultForwarder (ILogSaver logSaver,listeners, IConfiguration config)
参数 | |
---|---|
logSaver |
ILogSaver |
listeners |
|
config |
IConfiguration |
公共方法
invocationEnded
public void invocationEnded (long elapsedTime)
报告调用已终止,无论是成功终止还是因某种错误条件而终止。
将由 TradeFederation 框架自动调用。
参数 | |
---|---|
elapsedTime |
long :调用的用时(以毫秒为单位) |
invocationStarted
public void invocationStarted (IInvocationContext context)
报告测试调用的开始。
将由 TradeFederation 框架自动调用。报告程序需要替换此方法才能支持多设备报告。
参数 | |
---|---|
context |
IInvocationContext :调用相关信息 |
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 ,应与测试用例相关联。 |
logFile
public static void logFile (listeners, ILogSaver saver, InputStreamSource source, String name, LogDataType type)
在完成之前记录最终文件
参数 | |
---|---|
listeners |
|
saver |
ILogSaver |
source |
InputStreamSource |
name |
String |
type |
LogDataType |
reportEndHostLog
public static void reportEndHostLog (listeners, ILogSaver saver, String name)
报告正在进行的会话中的 host_log。
参数 | |
---|---|
listeners |
|
saver |
ILogSaver |
name |
String |
testLog
public void testLog (String dataName, LogDataType dataType, InputStreamSource dataStream)
提供测试调用中的关联日志或调试数据。
必须在 ERROR(/ITestInvocationListener#invocationFailed(Throwable))
或 ERROR(/ITestInvocationListener#invocationEnded(long))
之前调用
TradeFederation 框架会自动调用此方法,提供主机日志和(如果适用)设备 logcat。
此外,使用全局 ILogSaver
保存日志文件,并为实现 ILogSaverListener
接口的监听器调用 ILogSaverListener.testLogSaved(String, LogDataType, InputStreamSource, LogFile)
。
参数 | |
---|---|
dataName |
String :数据的 String 描述性名称,例如“device_logcat”。注意:每次调用时,dataName 可能不唯一。即,实现者必须能够处理具有相同 dataName 的多次调用 |
dataType |
LogDataType :数据的 LogDataType |
dataStream |
InputStreamSource :数据的 InputStreamSource 。实现人员应调用 createInputStream 以开始读取数据,并确保在完成后关闭生成的 InputStream。调用方应确保数据源在 testLog 方法完成之前保持存在且可访问。 |
testLogForward
public void testLogForward (String dataName, LogDataType dataType, InputStreamSource dataStream)
仅转发 testLog,而不是先保存日志。
参数 | |
---|---|
dataName |
String |
dataType |
LogDataType |
dataStream |
InputStreamSource |
testLogSaved
public void testLogSaved (String dataName, LogDataType dataType, InputStreamSource dataStream, LogFile logFile)
在保存测试日志时调用。
应改为使用 ITestInvocationListener.testLog(String, LogDataType,
InputStreamSource)
。
如果 LogSaverResultForwarder
封装在另一个容器中,请确保我们将 testLogSaved 回调转发到其下的监听器。
参数 | |
---|---|
dataName |
String :数据的 String 描述性名称,例如“device_logcat”。注意:每次调用时,dataName 可能不唯一。即,实现者必须能够处理具有相同 dataName 的多次调用 |
dataType |
LogDataType :数据的 LogDataType |
dataStream |
InputStreamSource :数据的 InputStreamSource 。实现人员应调用 createInputStream 以开始读取数据,并确保在完成后关闭生成的 InputStream。 |
logFile |
LogFile :包含已保存文件的元数据的 LogFile 。 |