控制台結果報告器

public class ConsoleResultReporter
extends TestResultListener implements ILogSaverListener , ITestInvocationListener

java.lang.Object
com.android.tradefed.result.TestResultListener
com.android.tradefed.result.ConsoleResultReporter


結果報告器將測試結果打印到控制台。

打印每個測試運行、每個測試用例以及測試指標、測試日誌和測試文件位置。

概括

公共構造函數

ConsoleResultReporter ()

公共方法

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 testLogSaved (String dataName, LogDataType dataType, InputStreamSource dataStream, LogFile logFile)

保存測試日誌時調用。

void testResult ( TestDescription test, TestResult result)
void testRunEnded (long elapsedTimeMillis, metrics) testRunEnded (long elapsedTimeMillis, metrics)

報告測試運行結束。

void testRunFailed ( FailureDescription failure)

報告測試運行由於FailureDescription描述的故障而未能完成。

void testRunFailed (String errorMessage)

報告測試運行由於致命錯誤而未能完成。

void testRunStarted (String runName, int testCount)

報告測試運行的開始。

公共構造函數

控制台結果報告器

public ConsoleResultReporter ()

公共方法

調用結束

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 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

測試結果

public void testResult (TestDescription test, 
                TestResult result)

參數
test TestDescription

result TestResult

測試運行結束

public void testRunEnded (long elapsedTimeMillis, 
                 metrics)

報告測試運行結束。 FIXME:我們不能有兩個不同類型的 Map<> 接口,所以我們必須在這裡使用 HashMap。

參數
elapsedTimeMillis long :設備報告的經過時間,以毫秒為單位

metrics :使用Metric測試運行結束時報告的鍵值對。

測試運行失敗

public void testRunFailed (FailureDescription failure)

報告測試運行由於FailureDescription描述的故障而未能完成。

參數
failure FailureDescription :描述故障及其上下文的FailureDescription

測試運行失敗

public void testRunFailed (String errorMessage)

報告測試運行由於致命錯誤而未能完成。

參數
errorMessage String :描述運行失敗原因的String

測試運行開始

public void testRunStarted (String runName, 
                int testCount)

報告測試運行的開始。

參數
runName String : 測試運行名稱

testCount int : 測試運行中的測試總數