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) |
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) 由於 |
void | testRunFailed (String errorMessage) 報告測試運行由於致命錯誤而未能完成。 |
void | testStarted ( TestDescription test, long startTime) |
常量
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 finalTIMEOUT_MESSAGES
公共構造函數
LogcatCrashResultForwarder
public LogcatCrashResultForwarder (ITestDevice device, ITestInvocationListener... listeners)
參數 | |
---|---|
device | ITestDevice |
listeners | ITestInvocationListener |
公共方法
設置包名
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 :測試結束的時間,通過ERROR(/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 : ERROR(/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 :測試開始的時間,通過ERROR(/System#currentTimeMillis()) 測量 |