結果和日誌轉發器

public class ResultAndLogForwarder
extends ResultForwarder implements ILogSaverListener

java.lang.Object
com.android.tradefed.result.ResultForwarder
com.android.tradefed.result.ResultAndLogForwarder


結果和日誌事件的轉發器。

概括

公共構造函數

ResultAndLogForwarder ( listeners) ResultAndLogForwarder ( listeners)

Ctor

ResultAndLogForwarder ( ITestInvocationListener... listeners)

公共方法

void invocationEnded (long elapsedTime)

報告調用已終止,無論是成功終止還是由於某些錯誤情況。

void invocationStarted ( IInvocationContext context)

報告測試調用的開始。

void logAssociation (String dataName, LogFile logFile)

在某些情況下,日誌必須與測試用例強關聯,但有機會這樣做就直接testLogSaved(String, com.android.tradefed.result.LogDataType, com.android.tradefed.result.InputStreamSource, com.android.tradefed.result.LogFile)回調是不可能的。

void setLogSaver ( ILogSaver logSaver)

設置ILogSaver以允許實施者保存文件。

void testLogSaved (String dataName, LogDataType dataType, InputStreamSource dataStream, LogFile logFile)

保存測試日誌時調用。

公共構造函數

結果和日誌轉發器

public ResultAndLogForwarder ( listeners)

Ctor

參數
listeners

結果和日誌轉發器

public ResultAndLogForwarder (ITestInvocationListener... listeners)

參數
listeners ITestInvocationListener

公共方法

調用結束

public void invocationEnded (long elapsedTime)

報告調用已終止,無論是成功終止還是由於某些錯誤情況。

將由 TradeFederation 框架自動調用。

參數
elapsedTime long :調用經過的時間(以毫秒為單位)

調用開始

public void invocationStarted (IInvocationContext context)

報告測試調用的開始。

將由 TradeFederation 框架自動調用。記者需要覆蓋此方法以支持多設備報告。

參數
context IInvocationContext :有關調用的信息

日誌關聯

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 ,應該與測試用例相關聯。

設置日誌保存器

public void setLogSaver (ILogSaver logSaver)

設置ILogSaver以允許實施者保存文件。

參數
logSaver ILogSaverILogSaver

測試日誌已保存

public void testLogSaved (String dataName, 
                LogDataType dataType, 
                InputStreamSource dataStream, 
                LogFile logFile)

保存測試日誌時調用。

應該用來代替ITestInvocationListener#testLog(String, LogDataType, InputStreamSource)

參數
dataName String :數據的ERROR(/String)描述性名稱。例如“device_logcat”。注意 dataName 每次調用可能不是唯一的。即實現者必須能夠處理具有相同數據名的多個調用

dataType LogDataType :數據的LogDataType

dataStream InputStreamSource :數據的InputStreamSource 。實施者應調用 createInputStream 開始讀取數據,並確保在完成後關閉生成的 InputStream。

logFile LogFile :包含已保存文件的元數據的LogFile