文本結果報告器

public class TextResultReporter
extends InvocationToJUnitResultForwarder implements ITestInvocationListener , ILogSaverListener

java.lang.Object
com.android.tradefed.result.InvocationToJUnitResultForwarder
com.android.tradefed.result.TextResultReporter


將結果轉發到 JUnit 文本結果打印機的測試結果報告器。

概括

公共構造函數

TextResultReporter ()

創建一個TextResultReporter

公共方法

void testAssumptionFailure ( TestDescription testId, String trace)

當原子測試標記它假定條件為假時調用

void testEnded ( TestDescription testId, metrics) testEnded ( TestDescription testId, metrics)

覆蓋父級以顯式打印出測試指標。

void testFailed ( TestDescription testId, String trace)

覆蓋父級以顯式打印失敗。

void testLog (String dataName, LogDataType dataType, InputStreamSource dataStream)

提供來自測試調用的關聯日誌或調試數據。

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

保存測試日誌時調用。

void testRunEnded (long elapsedTime, metrics) testRunEnded (long elapsedTime, metrics)

覆蓋父級以明確打印出指標。

公共構造函數

文本結果報告器

public TextResultReporter ()

創建一個TextResultReporter

公共方法

測試假設失敗

public void testAssumptionFailure (TestDescription testId, 
                String trace)

當原子測試標記它假定條件為假時調用

參數
testId TestDescription :標識測試

trace String :失敗的堆棧跟踪

測試結束

public void testEnded (TestDescription testId, 
                 metrics)

覆蓋父級以顯式打印出測試指標。

參數
testId TestDescription :標識測試

metrics : 發出的指標的ERROR(/Map)

測試失敗

public void testFailed (TestDescription testId, 
                String trace)

覆蓋父級以顯式打印失敗。 ResultPrinter 依賴運行程序在測試運行結束時調用“print”來執行此操作。報告單個測試用例的失敗。

將在 testStarted 和 testEnded 之間調用。

參數
testId TestDescription :標識測試

trace String :失敗的堆棧跟踪

測試日誌

public void testLog (String dataName, 
                LogDataType dataType, 
                InputStreamSource dataStream)

提供來自測試調用的關聯日誌或調試數據。

必須在ERROR(/ITestInvocationListener#invocationFailed(Throwable))ERROR(/ITestInvocationListener#invocationEnded(long))之前調用

TradeFederation 框架將自動調用此方法,提供主機日誌和設備 logcat(如果適用)。

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

dataType LogDataType :數據的LogDataType

dataStream InputStreamSource :數據的InputStreamSource 。實施者應調用 createInputStream 開始讀取數據,並確保在完成後關閉生成的 InputStream。調用者應確保數據源保持存在且可訪問,直到 testLog 方法完成。

測試日誌已保存

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

測試運行結束

public void testRunEnded (long elapsedTime, 
                 metrics)

覆蓋父級以明確打印出指標。

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

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