ResultAggregator
public
class
ResultAggregator
extends CollectingTestListener
| java.lang.Object | ||
| ↳ | com.android.tradefed.result.CollectingTestListener | |
| ↳ | com.android.tradefed.retry.ResultAggregator | |
特殊轉送器,可根據採用的重試策略,在需要時匯總結果。
摘要
公用建構函式 | |
|---|---|
ResultAggregator(
|
|
公用方法 | |
|---|---|
void
|
cleanEventsFiles()
|
final
void
|
forwardAggregatedInvocationLogs()
將所有叫用層級記錄轉送至不支援精細結果的結果回報器。 |
void
|
invocationEnded(long elapsedTime)
回報叫用已終止,無論是成功或因某些錯誤條件而終止。 |
void
|
invocationFailed(FailureDescription failure)
|
void
|
invocationFailed(Throwable cause)
因某些錯誤情況而回報不完整的叫用。 |
void
|
invocationSkipped(SkipReason reason)
將叫用動作回報為略過 |
void
|
invocationStarted(IInvocationContext context)
回報測試叫用作業的開始時間。 |
void
|
logAssociation(String dataName, LogFile logFile)
在某些情況下,記錄必須與測試案例建立強烈關聯,但無法直接在 |
void
|
setLogSaver(ILogSaver logSaver)
|
void
|
setUpdatedReporting(boolean updatedReporting)
設定新報表。 |
void
|
testAssumptionFailure(TestDescription test, String trace)
當原子測試標記假設條件為 false 時,系統會呼叫此方法 |
void
|
testAssumptionFailure(TestDescription test, FailureDescription failure)
當原子測試標記假設條件為 false 時,系統會呼叫此方法 |
void
|
testEnded(TestDescription test, long endTime,
|
void
|
testFailed(TestDescription test, FailureDescription failure)
回報個別測試案例的失敗情形。 |
void
|
testFailed(TestDescription test, String trace)
回報個別測試案例的失敗情形。 |
void
|
testIgnored(TestDescription test)
當測試不會執行時,系統會呼叫此方法,通常是因為測試方法已標記為 org.junit.Ignore。 |
void
|
testLog(String dataName, LogDataType dataType, InputStreamSource dataStream)
|
void
|
testLogSaved(String dataName, LogDataType dataType, InputStreamSource dataStream, LogFile logFile)
|
void
|
testModuleEnded()
回報模組執行作業結束。 |
void
|
testModuleStarted(IInvocationContext moduleContext)
回報模組開始執行的時間。 |
void
|
testRunEnded(long elapsedTime,
回報測試執行結束。 |
void
|
testRunFailed(FailureDescription failure)
由於 |
void
|
testRunFailed(String errorMessage)
由於發生致命錯誤,因此無法完成報表測試。 |
void
|
testRunStarted(String name, int testCount, int attemptNumber, long startTime)
回報測試執行作業的開始時間。 |
void
|
testSkipped(TestDescription test, SkipReason reason)
當測試遭到略過,且未因通常預期的原因而執行時,系統會呼叫此方法。 |
void
|
testStarted(TestDescription test, long startTime)
|
受保護的方法 | |
|---|---|
File[]
|
getEventsLogs()
|
公用建構函式
ResultAggregator
public ResultAggregator (listeners, RetryStrategy strategy)
| 參數 | |
|---|---|
listeners |
|
strategy |
RetryStrategy |
公用方法
cleanEventsFiles
public void cleanEventsFiles ()
forwardAggregatedInvocationLogs
public final void forwardAggregatedInvocationLogs ()
將所有叫用層級記錄轉送至不支援精細結果的結果回報器。
invocationEnded
public void invocationEnded (long elapsedTime)
回報叫用已終止,無論是成功或因某些錯誤條件而終止。
會由 TradeFederation 架構自動呼叫。
| 參數 | |
|---|---|
elapsedTime |
long:叫用作業的經過時間 (以毫秒為單位) |
invocationFailed
public void invocationFailed (FailureDescription failure)
| 參數 | |
|---|---|
failure |
FailureDescription |
invocationFailed
public void invocationFailed (Throwable cause)
由於某些錯誤情況,因此回報未完成的叫用作業。
會由 TradeFederation 架構自動呼叫。
| 參數 | |
|---|---|
cause |
Throwable:失敗的 Throwable 原因 |
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,應與測試案例相關聯。 |
setUpdatedReporting
public void setUpdatedReporting (boolean updatedReporting)
設定新報表。
| 參數 | |
|---|---|
updatedReporting |
boolean |
testAssumptionFailure
public void testAssumptionFailure (TestDescription test, String trace)
當原子測試標記假設條件為 false 時,系統會呼叫此方法
| 參數 | |
|---|---|
test |
TestDescription:用於識別測試 |
trace |
String:失敗的堆疊追蹤 |
testAssumptionFailure
public void testAssumptionFailure (TestDescription test, FailureDescription failure)
當原子測試標記假設條件為 false 時,系統會呼叫此方法
| 參數 | |
|---|---|
test |
TestDescription:用於識別測試 |
failure |
FailureDescription:FailureDescription 可說明失敗和相關情境。 |
testEnded
public void testEnded (TestDescription test, long endTime,testMetrics)
ERROR(/#testEnded(com.android.tradefed.result.TestDescription,Map)) 的替代方案,可直接指定結束時間。搭配使用 testStarted(com.android.tradefed.result.TestDescription, long) 可獲得準確的測量結果。
| 參數 | |
|---|---|
test |
TestDescription:用於識別測試 |
endTime |
long:測試結束的時間,透過 System.currentTimeMillis() 測量 |
testMetrics |
:傳送指標的 ERROR(/Map) |
testFailed
public void testFailed (TestDescription test, FailureDescription failure)
回報個別測試案例的失敗情形。
會在 testStarted 和 testEnded 之間呼叫。
| 參數 | |
|---|---|
test |
TestDescription:用於識別測試 |
failure |
FailureDescription:FailureDescription 可說明失敗和相關情境。 |
testFailed
public void testFailed (TestDescription test, String trace)
回報個別測試案例的失敗情形。
會在 testStarted 和 testEnded 之間呼叫。
| 參數 | |
|---|---|
test |
TestDescription:用於識別測試 |
trace |
String:失敗的堆疊追蹤 |
testIgnored
public void testIgnored (TestDescription test)
當測試不會執行時,系統會呼叫此方法,通常是因為測試方法已標註為 org.junit.Ignore。
| 參數 | |
|---|---|
test |
TestDescription:用於識別測試 |
testLog
public void testLog (String dataName,
LogDataType dataType,
InputStreamSource dataStream)| 參數 | |
|---|---|
dataName |
String |
dataType |
LogDataType |
dataStream |
InputStreamSource |
testLogSaved
public void testLogSaved (String dataName,
LogDataType dataType,
InputStreamSource dataStream,
LogFile logFile)| 參數 | |
|---|---|
dataName |
String |
dataType |
LogDataType |
dataStream |
InputStreamSource |
logFile |
LogFile |
testModuleEnded
public void testModuleEnded ()
回報模組執行作業結束。
testModuleStarted
public void testModuleStarted (IInvocationContext moduleContext)
回報模組開始執行的時間。這個回呼與 testModuleEnded() 相關聯,在序列中為選用項目。只有在使用模組:套件式執行程式的執行期間才會使用。
| 參數 | |
|---|---|
moduleContext |
IInvocationContext:模組的 IInvocationContext。 |
testRunEnded
public void testRunEnded (long elapsedTime,
runMetrics) 回報測試執行結束。
| 參數 | |
|---|---|
elapsedTime |
long:裝置回報的經過時間,以毫秒為單位 |
runMetrics |
:測試執行結束時回報的鍵/值組合 |
testRunFailed
public void testRunFailed (FailureDescription failure)
由於 FailureDescription 所述的錯誤,導致報表測試執行作業無法完成。
| 參數 | |
|---|---|
failure |
FailureDescription:FailureDescription 可說明失敗和相關情境。 |
testRunFailed
public void testRunFailed (String errorMessage)
由於發生致命錯誤,因此無法完成報表測試執行作業。
| 參數 | |
|---|---|
errorMessage |
String:String,說明執行失敗的原因。 |
testRunStarted
public void testRunStarted (String name,
int testCount,
int attemptNumber,
long startTime)回報測試執行作業的開始時間。
| 參數 | |
|---|---|
name |
String:測試執行作業名稱 |
testCount |
int:測試執行作業中的測試總數 |
attemptNumber |
int:訂單號碼,用於識別同一個 runName 執行多次的不同嘗試。attemptNumber 的索引為 0,每次執行新測試時,應增加 1。舉例來說,如果測試重試 3 次,則在相同的 runName 下,應有 4 次總執行次數,而 attemptNumber 則從 0 到 3。 |
startTime |
long:透過 System.currentTimeMillis() 測量的執行作業開始時間 |
testSkipped
public void testSkipped (TestDescription test, SkipReason reason)
當測試遭到略過,且未因通常預期的原因而執行時,系統會呼叫此方法。系統會嘗試重試這些測試,以便取得正確的執行結果。
| 參數 | |
|---|---|
test |
TestDescription:用於識別測試 |
reason |
SkipReason:SkipReason |
testStarted
public void testStarted (TestDescription test, long startTime)
testStarted(com.android.tradefed.result.TestDescription) 的替代方案,我們也會指定測試開始時間,並搭配 ERROR(/#testEnded(com.android.tradefed.result.TestDescription,long,Map)) 進行精確評估。
| 參數 | |
|---|---|
test |
TestDescription:用於識別測試 |
startTime |
long:測試開始的時間,透過 System.currentTimeMillis() 測量 |
受保護的方法
getEventsLogs
protected File[] getEventsLogs ()
| 傳回 | |
|---|---|
File[] |
|