LogcatCrashResultForwarder

public class LogcatCrashResultForwarder
extends ResultForwarder

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


特殊偵聽器:當發生故障(偵測進程崩潰)時,它將嘗試從 logcat 中提取崩潰並將其新增至與測試關聯的失敗訊息。

概括

常數

int MAX_NUMBER_CRASH

領域

public static final String ERROR_MESSAGE

當設備端出現問題時,儀器會發出特殊錯誤訊息。

public static final String INCOMPLETE_MESSAGE

public static final 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) 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) testRunEnded (long elapsedTime, runMetrics)

報告測試運行結束。

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))進行準確測量。

常數

MAX_NUMBER_CRASH

public static final int MAX_NUMBER_CRASH

常量值:3 (0x00000003)

領域

錯誤訊息

public static final String ERROR_MESSAGE

當設備端出現問題時,儀器會發出特殊錯誤訊息。

INCOMPLETE_MESSAGE

public static final String INCOMPLETE_MESSAGE

SYSTEM_CRASH_MESSAGE

public static final String SYSTEM_CRASH_MESSAGE

逾時訊息

public static final  TIMEOUT_MESSAGES

公共構造函數

LogcatCrashResultForwarder

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

參數
device ITestDevice

listeners ITestInvocationListener

公共方法

取得設備

public ITestDevice getDevice ()

退貨
ITestDevice

設定包名

public void setPackageName (String packageName)

參數
packageName String

測試結束

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 FailureDescription :描述故障及其上下文的FailureDescription

測試失敗

public void testFailed (TestDescription test, 
                String trace)

報告單一測試用例的失敗。

將在 testStarted 和 testEnded 之間呼叫。

參數
test TestDescription :標識測試

trace String : 失敗的堆疊追蹤

測試運行結束

public void testRunEnded (long elapsedTime, 
                 runMetrics)

報告測試運行結束。 FIXME:我們不能有兩個不同類型的 Map<> 接口,所以我們必須在這裡使用 HashMap。

參數
elapsedTime long :設備報告的經過時間,以毫秒為單位

runMetrics :使用Metric測試運行結束時報告的鍵值對。

測試運行失敗

public void testRunFailed (FailureDescription error)

報告測試運行由於FailureDescription描述的故障而未能完成。

參數
error FailureDescription :描述故障及其上下文的FailureDescription

測試運行失敗

public void testRunFailed (String errorMessage)

報告測試運行因致命錯誤而未能完成。

參數
errorMessage String :描述運行失敗原因的String

測試開始

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