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)
Reports the start of the test invocation. |
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, Map<String, String> metrics)
Reports end of test run. |
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,LogDataType,InputStreamSource,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,
Map<String, String> metrics)測試執行結束時的報告。
| 參數 | |
|---|---|
elapsedTimeMillis |
long:裝置回報的經過時間 (以毫秒為單位) |
metrics |
Map:在測試執行結束時回報的鍵/值組合 |
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:測試執行作業中的測試總數 |