ConsoleResultReporter
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)
在某些情況下,記錄必須與測試案例建立強連結,但無法直接在 |
void
|
testLogSaved(String dataName, LogDataType dataType, InputStreamSource dataStream, LogFile logFile)
儲存測試記錄時呼叫。 |
void
|
testResult(TestDescription test, TestResult result)
|
void
|
testRunEnded(long elapsedTimeMillis,
回報測試執行結束。 |
void
|
testRunFailed(FailureDescription failure)
由於 |
void
|
testRunFailed(String errorMessage)
由於發生致命錯誤,報表測試執行作業無法完成。 |
void
|
testRunStarted(String runName, int testCount)
回報測試執行作業的開始時間。 |
公用建構函式
ConsoleResultReporter
public ConsoleResultReporter ()
公用方法
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,應與測試案例相關聯。 |
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。 |
testResult
public void testResult (TestDescription test, TestResult result)
| 參數 | |
|---|---|
test |
TestDescription |
result |
TestResult |
testRunEnded
public void testRunEnded (long elapsedTimeMillis,
metrics) 回報測試執行結束。
| 參數 | |
|---|---|
elapsedTimeMillis |
long:裝置回報的經過時間,以毫秒為單位 |
metrics |
:測試執行結束時回報的鍵/值組合 |
testRunFailed
public void testRunFailed (FailureDescription failure)
由於 FailureDescription 所述的錯誤,導致報表測試執行作業無法完成。
| 參數 | |
|---|---|
failure |
FailureDescription:FailureDescription 可說明失敗和其情境。 |
testRunFailed
public void testRunFailed (String errorMessage)
由於發生致命錯誤,報表測試執行作業無法完成。
| 參數 | |
|---|---|
errorMessage |
String:String,說明執行失敗的原因。 |
testRunStarted
public void testRunStarted (String runName,
int testCount)回報測試執行作業的開始時間。
| 參數 | |
|---|---|
runName |
String:測試執行作業名稱 |
testCount |
int:測試執行作業中的測試總數 |