PrettyTestEventLogger

public class PrettyTestEventLogger
extends Object implements ITestInvocationListener

java.lang.Object
   ↳ com.android.tradefed.testtype.host.PrettyTestEventLogger


記錄器會比對事件並記錄,方便您進行偵錯。主機端和裝置端的記錄檔會嚴格比對,方便您搜尋。

摘要

公用建構函式

PrettyTestEventLogger(List<ITestDevice> devices, boolean methodLevelLogging)

公用方法

void testEnded(TestDescription test, HashMap<String, MetricMeasurement.Metric> testMetrics)

回報個別測試案例的執行結束時間。

void testFailed(TestDescription test, FailureDescription failure)

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

void testFailed(TestDescription test, String trace)

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

void testRunEnded(long elapsedTimeMillis, HashMap<String, MetricMeasurement.Metric> runMetrics)

Reports end of test run.

void testRunStarted(String runName, int testCount)

回報測試執行的開始。

void testStarted(TestDescription test)

回報個別測試案例的開始時間。

公用建構函式

PrettyTestEventLogger

public PrettyTestEventLogger (List<ITestDevice> devices, 
                boolean methodLevelLogging)

參數
devices List

methodLevelLogging boolean

公用方法

testEnded

public void testEnded (TestDescription test, 
                HashMap<String, MetricMeasurement.Metric> testMetrics)

回報個別測試案例的執行結束時間。

如果未叫用 testFailed(TestDescription, FailureDescription),這項測試就會通過。也會傳回測試案例執行期間可能發出的任何鍵/值指標。

參數
test TestDescription:識別測試

testMetrics HashMap:發出的指標 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:失敗的堆疊追蹤

testRunEnded

public void testRunEnded (long elapsedTimeMillis, 
                HashMap<String, MetricMeasurement.Metric> runMetrics)

測試執行結束時會回報。FIXME:我們無法使用不同型別的兩個 Map<> 介面,因此必須在此使用 HashMap。

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

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

testRunStarted

public void testRunStarted (String runName, 
                int testCount)

回報測試執行的開始時間。

參數
runName String:測試執行名稱

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

testStarted

public void testStarted (TestDescription test)

回報個別測試案例的開始時間。舊版介面,建議盡可能使用 testStarted(TestDescription)

參數
test TestDescription:識別測試