事件記錄器監聽器

public class EventsLoggerListener
extends Object implements ILogSaverListener

java.lang.Object
   ↳ com.android.tradefed.result.EventsLoggerListener


會記錄其收到的所有事件到檔案的接聽程式

摘要

公用建構函式

EventsLoggerListener(String name)

公用方法

File getLoggedEvents()
void invocationEnded(long elapsedTime)

回報叫用已終止 (無論成功或因某些錯誤而終止) 值。

void invocationFailed(FailureDescription failure)

回報因某些錯誤條件而不完整的叫用。

void invocationSkipped(SkipReason reason)

將叫用回報為略過

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 testAssumptionFailure(TestDescription test, String trace)

在不可部分完成的測試旗標假設條件為 false 時呼叫

void testAssumptionFailure(TestDescription test, FailureDescription failure)

在不可部分完成的測試旗標假設條件為 false 時呼叫

void testEnded(TestDescription test, long endTime, testMetrics)

ERROR(/#testEnded(com.android.tradefed.result.TestDescription,Map)) 的替代方式,可以指定結束時間

void testFailed(TestDescription test, FailureDescription failure)

回報個別測試案例的失敗情形。

void testFailed(TestDescription test, String trace)

回報個別測試案例的失敗情形。

void testIgnored(TestDescription test)

在測試不執行時呼叫的呼叫,通常是因為測試方法加上了 org.junit.Ignore

void testModuleEnded()

回報模組的執行完畢。

void testModuleStarted(IInvocationContext moduleContext)

回報執行模組的開始。

void testRunEnded(long elapsedTimeMillis, runMetrics)

測試執行結束報表。

void testRunFailed(FailureDescription failure)

由於「FailureDescription」指出失敗,因此無法完成報表測試。

void testRunFailed(String errorMessage)

發生嚴重錯誤,因此無法完成報表測試。

void testRunStarted(String runName, int testCount, int attemptNumber)

回報測試執行作業的開始。

void testRunStarted(String runName, int testCount)

回報測試執行作業的開始。

void testRunStarted(String runName, int testCount, int attemptNumber, long startTime)

回報測試執行作業的開始。

void testSkipped(TestDescription test, SkipReason reason)

測試被略過,且因非預期原因而未執行時呼叫。

void testStarted(TestDescription test, long startTime)

testStarted(com.android.tradefed.result.TestDescription) 的替代方式,我們會一併指定測試的時間 再加上 ERROR(/#testEnded(com.android.tradefed.result.TestDescription,long,Map)),才能取得準確的測量結果

公用建構函式

事件記錄器監聽器

public EventsLoggerListener (String name)

參數
name String

公用方法

getLoggedEvents

public File getLoggedEvents ()

傳回
File

已叫用

public void invocationEnded (long elapsedTime)

回報叫用已終止 (無論成功或因某些錯誤而終止) 值。

將由 TradeFederation 架構自動呼叫。

參數
elapsedTime long:叫用的經過時間 (以毫秒為單位)

叫用失敗

public void invocationFailed (FailureDescription failure)

回報因某些錯誤條件而不完整的叫用。

將由 TradeFederation 架構自動呼叫。

參數
failure FailureDescription:說明失敗原因的 FailureDescription

已略過叫用

public void invocationSkipped (SkipReason reason)

將叫用回報為略過

參數
reason SkipReason

叫用

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 LogFileLogFile之前記錄且應與 測試案例

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 FailureDescriptionFailureDescription,說明失敗及其背景資訊。

測試結束

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)

測試失敗

public void testFailed (TestDescription test, 
                FailureDescription failure)

回報個別測試案例的失敗情形。

這個值會在 testStarted 和 testEnded 之間呼叫。

參數
test TestDescription:識別測試

failure FailureDescriptionFailureDescription,說明失敗及其背景資訊。

測試失敗

public void testFailed (TestDescription test, 
                String trace)

回報個別測試案例的失敗情形。

這個值會在 testStarted 和 testEnded 之間呼叫。

參數
test TestDescription:識別測試

trace String:失敗的堆疊追蹤

已忽略測試

public void testIgnored (TestDescription test)

在測試不執行時呼叫的呼叫,通常是因為測試方法加上了 org.junit.Ignore

參數
test TestDescription:識別測試

testModuleEnded

public void testModuleEnded ()

回報模組的執行完畢。

testModuleStarted

public void testModuleStarted (IInvocationContext moduleContext)

回報執行模組的開始。這個回呼與 testModuleEnded() 相關聯,在序列中是選用選項。只會在使用 模組:套件型執行器

參數
moduleContext IInvocationContext:模組的 IInvocationContext

testRunEnded

public void testRunEnded (long elapsedTimeMillis, 
                 runMetrics)

測試執行結束報表。FIXME:我們不能有兩張地圖<>產生不同類型的介面 我們一定要在這裡使用 HashMap

參數
elapsedTimeMillis long:裝置回報的經過時間 (以毫秒為單位)

runMetrics :使用 Metric 的測試執行結束時回報的鍵/值組合。

testRunFailed

public void testRunFailed (FailureDescription failure)

由於「FailureDescription」指出失敗,因此無法完成報表測試。

參數
failure FailureDescriptionFailureDescription,說明失敗及其背景資訊。

testRunFailed

public void testRunFailed (String errorMessage)

發生嚴重錯誤,因此無法完成報表測試。

參數
errorMessage StringString 說明執行失敗的原因。

testRunStarted

public void testRunStarted (String runName, 
                int testCount, 
                int attemptNumber)

回報測試執行作業的開始。

參數
runName String:測試執行作業名稱

testCount int:測試執行作業中的測試總數

attemptNumber int:訂單號碼,可識別同一個 runName 的不同嘗試次數 執行多次tryNumber 為 0 的索引,且每次都會遞增 新的執行作業發生時例如:每次執行精細的重試測試 3 次,總共應該有 4 次 在同一個 runName 下執行,且 tryNumber 介於 0 到 3 之間。

testRunStarted

public void testRunStarted (String runName, 
                int testCount)

回報測試執行作業的開始。

參數
runName String:測試執行作業名稱

testCount int:測試執行作業中的測試總數

testRunStarted

public void testRunStarted (String runName, 
                int testCount, 
                int attemptNumber, 
                long startTime)

回報測試執行作業的開始。

參數
runName String:測試執行作業名稱

testCount int:測試執行作業中的測試總數

attemptNumber int:訂單號碼,可識別同一個 runName 的不同嘗試次數 執行多次tryNumber 為 0 的索引,且每次傳回 新的工作也會開始執行例如:執行精細的重試 3 次測試,總共應執行 4 次測試 同一個 runName,且 tryNumber 介於 0 到 3 之間。

startTime long:執行作業開始的時間,透過 System.currentTimeMillis() 測量

測試略過

public void testSkipped (TestDescription test, 
                SkipReason reason)

測試被略過,且因非預期原因而未執行時呼叫。 系統會嘗試重新嘗試這些測試,以便執行正確的作業。

參數
test TestDescription:識別測試

reason SkipReasonSkipReason

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() 進行測量