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
List<String> |
TIMEOUT_MESSAGES
|
公用建構函式 | |
|---|---|
LogcatCrashResultForwarder(ITestDevice device, ITestInvocationListener... listeners)
|
|
公用方法 | |
|---|---|
ITestDevice
|
getDevice()
|
void
|
setPackageName(String packageName)
|
void
|
testEnded(TestDescription test, long endTime, HashMap<String, MetricMeasurement.Metric> testMetrics)
|
void
|
testFailed(TestDescription test, FailureDescription failure)
回報個別測試案例的失敗情形。 |
void
|
testFailed(TestDescription test, String trace)
回報個別測試案例的失敗情形。 |
void
|
testRunEnded(long elapsedTime, HashMap<String, MetricMeasurement.Metric> runMetrics)
Reports end of test run. |
void
|
testRunFailed(FailureDescription error)
由於 |
void
|
testRunFailed(String errorMessage)
發生嚴重錯誤,因此無法完成報表測試執行。 |
void
|
testStarted(TestDescription test, long startTime)
|
常數
ERROR_MESSAGE
public static final String ERROR_MESSAGE
如果裝置端發生錯誤,儀器會顯示特殊錯誤訊息。
常數值: 「程序已當機。」
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
常數值: 「系統已當機。」
欄位
TIMEOUT_MESSAGES
public static final List<String> TIMEOUT_MESSAGES
公用建構函式
LogcatCrashResultForwarder
public LogcatCrashResultForwarder (ITestDevice device, ITestInvocationListener... listeners)
| 參數 | |
|---|---|
device |
ITestDevice |
listeners |
ITestInvocationListener |
公用方法
setPackageName
public void setPackageName (String packageName)
| 參數 | |
|---|---|
packageName |
String |
testEnded
public void testEnded (TestDescription test, long endTime, HashMap<String, MetricMeasurement.Metric> testMetrics)
testEnded(TestDescription,Map) 的替代方案,可直接指定結束時間。搭配 testStarted(TestDescription,long) 使用,可準確測量。
| 參數 | |
|---|---|
test |
TestDescription:識別測試 |
endTime |
long:測試結束時間,透過 System.currentTimeMillis() 測量 |
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 elapsedTime,
HashMap<String, MetricMeasurement.Metric> runMetrics)測試執行結束時會回報。FIXME:我們無法使用不同型別的兩個 Map<> 介面,因此必須在此使用 HashMap。
| 參數 | |
|---|---|
elapsedTime |
long:裝置回報的經過時間 (以毫秒為單位) |
runMetrics |
HashMap:在測試執行結束時,使用 Metric 報告的鍵/值組合。 |
testRunFailed
public void testRunFailed (FailureDescription error)
由於 FailureDescription 所述的錯誤,報表測試執行作業無法完成。
| 參數 | |
|---|---|
error |
FailureDescription:說明失敗情形和相關情境的 FailureDescription。 |
testRunFailed
public void testRunFailed (String errorMessage)
發生嚴重錯誤,因此無法完成報表測試執行作業。
| 參數 | |
|---|---|
errorMessage |
String:String,說明執行失敗的原因。 |
testStarted
public void testStarted (TestDescription test, long startTime)
testStarted(TestDescription) 的替代方案,我們也會指定測試開始時間,並搭配 testEnded(TestDescription,long,Map) 進行準確的評估。
| 參數 | |
|---|---|
test |
TestDescription:識別測試 |
startTime |
long:測試開始時間,透過 System.currentTimeMillis() 測量 |