LogcatCrashResultForwarder

public class LogcatCrashResultForwarder
extends ResultForwarder

java.lang.Object
   ↳ com.android.tradefed.result.ResultForwarder
     ↳ com.android.tradefed.result.LogcatCrashResultForwarder


特殊監聽器:如果發生失敗 (儀器程序當機),系統會嘗試從 logcat 擷取當機資訊,並將其新增至與測試相關聯的失敗訊息。

摘要

常數

String ERROR_MESSAGE

如果裝置端發生錯誤,儀器會發出特殊錯誤訊息。

String INCOMPLETE_MESSAGE

int MAX_NUMBER_CRASH

String SYSTEM_CRASH_MESSAGE

欄位

public static final TIMEOUT_MESSAGES

公用建構函式

LogcatCrashResultForwarder(ITestDevice device, ITestInvocationListener... listeners)

公用方法

ITestDevice getDevice()
void setPackageName(String packageName)
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 testRunEnded(long elapsedTime, runMetrics)

Reports end of test run.

void testRunFailed(FailureDescription error)

由於 FailureDescription 所述的失敗情形,報表測試執行作業無法完成。

void testRunFailed(String errorMessage)

由於發生嚴重錯誤,報表測試執行作業無法完成。

void testStarted(TestDescription test, long startTime)

testStarted(com.android.tradefed.result.TestDescription) 的替代方案,我們也會指定測試開始時間,並搭配 ERROR(/#testEnded(com.android.tradefed.result.TestDescription,long,Map)) 進行準確的評估。

常數

ERROR_MESSAGE

public static final String ERROR_MESSAGE

裝置端發生錯誤時,儀器會發出特殊錯誤訊息。

常數值: 「Process crashed.」

INCOMPLETE_MESSAGE

public static final String INCOMPLETE_MESSAGE

常數值: 「測試執行作業無法完成」

MAX_NUMBER_CRASH

public static final int MAX_NUMBER_CRASH

常數值: 3 (0x00000003)

SYSTEM_CRASH_MESSAGE

public static final String SYSTEM_CRASH_MESSAGE

常數值: "System has crashed."

欄位

TIMEOUT_MESSAGES

public static final  TIMEOUT_MESSAGES

公用建構函式

LogcatCrashResultForwarder

public LogcatCrashResultForwarder (ITestDevice device, 
                ITestInvocationListener... listeners)

參數
device ITestDevice

listeners ITestInvocationListener

公用方法

getDevice

public ITestDevice getDevice ()

傳回
ITestDevice

setPackageName

public void setPackageName (String packageName)

參數
packageName String

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 FailureDescriptionFailureDescription,說明失敗情形和相關情境。

testFailed

public void testFailed (TestDescription test, 
                String trace)

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

會在 testStarted 和 testEnded 之間呼叫。

參數
test TestDescription:識別測試

trace String:失敗的堆疊追蹤

testRunEnded

public void testRunEnded (long elapsedTime, 
                 runMetrics)

報告測試執行結束時間。

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

runMetrics :在測試執行結束時回報的鍵/值組合

testRunFailed

public void testRunFailed (FailureDescription error)

由於 FailureDescription 所述的失敗情形,報表測試執行作業無法完成。

參數
error FailureDescriptionFailureDescription,說明失敗情形和相關情境。

testRunFailed

public void testRunFailed (String errorMessage)

發生嚴重錯誤,導致報表測試執行作業無法完成。

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

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