BugreportCollector
public
class
BugreportCollector
extends Object
implements
ITestInvocationListener
java.lang.Object | |
↳ | com.android.tradefed.result.BugreportCollector |
在可設定事件發生時收集錯誤報告的傳遞 ITestInvocationListener
,然後在收集每個錯誤報告後對其子項呼叫 ITestInvocationListener#testLog
。
行為:(FIXME:完成這項作業)
- 在任何測試案例失敗後擷取
- 在每個測試案例後擷取
- 在每個失敗的測試案例後擷取
- 擷取
摘要
巢狀類別 | |
---|---|
enum |
BugreportCollector.Filter
|
enum |
BugreportCollector.Freq
|
enum |
BugreportCollector.Noun
|
class |
BugreportCollector.Predicate
完整的述詞,說明擷取錯誤報告的時間。 |
enum |
BugreportCollector.Relation
|
interface |
BugreportCollector.SubPredicate
|
欄位 | |
---|---|
public
static
final
BugreportCollector.Predicate |
AFTER_FAILED_TESTCASES
在每個失敗的測試套件之後觸發的預先定義述詞 |
public
static
final
BugreportCollector.Predicate |
AT_START
預先定義的述詞,會在第一個叫用開始時觸發 |
公用建構函式 | |
---|---|
BugreportCollector(ITestInvocationListener listener, ITestDevice testDevice)
|
公用方法 | |
---|---|
void
|
addPredicate(BugreportCollector.Predicate p)
|
void
|
blockUntilIdle()
阻斷,直到收集器不再收集任何錯誤報告。 |
TestSummary
|
getSummary()
|
void
|
invocationEnded(long elapsedTime)
|
void
|
invocationFailed(Throwable cause)
|
void
|
invocationStarted(IInvocationContext context)
|
void
|
setAsynchronous(boolean asynchronous)
設定錯誤報告收集功能應在不同的執行緒中收集錯誤報告 ( |
void
|
setDescriptiveName(String name)
設定記錄錯誤報告時要使用的描述性名稱。 |
void
|
setDeviceWaitTime(int waitTime)
設定裝置上線的等待時間 (以秒為單位),以便我們嘗試擷取錯誤報告。 |
void
|
testAssumptionFailure(TestDescription test, String trace)
|
void
|
testEnded(TestDescription test,
|
void
|
testFailed(TestDescription test, String trace)
|
void
|
testIgnored(TestDescription test)
|
void
|
testLog(String dataName, LogDataType dataType, InputStreamSource dataStream)
|
void
|
testRunEnded(long elapsedTime,
|
void
|
testRunFailed(String errorMessage)
|
void
|
testRunStarted(String runName, int testCount)
|
void
|
testRunStopped(long elapsedTime)
|
void
|
testStarted(TestDescription test)
|
欄位
AFTER_FAILED_TESTCASES
public static final BugreportCollector.Predicate AFTER_FAILED_TESTCASES
在每個失敗的測試套件之後觸發的預先定義謂詞
公用建構函式
BugreportCollector
public BugreportCollector (ITestInvocationListener listener, ITestDevice testDevice)
參數 | |
---|---|
listener |
ITestInvocationListener |
testDevice |
ITestDevice |
公用方法
addPredicate
public void addPredicate (BugreportCollector.Predicate p)
參數 | |
---|---|
p |
BugreportCollector.Predicate |
blockUntilIdle
public void blockUntilIdle ()
阻斷,直到收集器停止收集任何錯誤報告為止。如果收集器未主動收集錯誤報告,請立即傳回
getSummary
public TestSummary getSummary ()
傳回 | |
---|---|
TestSummary |
invocationEnded
public void invocationEnded (long elapsedTime)
參數 | |
---|---|
elapsedTime |
long |
invocationFailed
public void invocationFailed (Throwable cause)
參數 | |
---|---|
cause |
Throwable |
invocationStarted
public void invocationStarted (IInvocationContext context)
參數 | |
---|---|
context |
IInvocationContext |
setAsynchronous
public void setAsynchronous (boolean asynchronous)
設定錯誤報告收集作業應在不同的執行緒中收集錯誤報告 (asynchronous = true
),還是在擷取到錯誤報告前封鎖呼叫端 (asynchronous = false
)。
參數 | |
---|---|
asynchronous |
boolean |
setDescriptiveName
public void setDescriptiveName (String name)
設定記錄錯誤報告時要使用的描述性名稱。如果為 null
,BugreportCollector
會改為執行預設行為,也就是將導致收集錯誤報告的事件名稱序列化。
參數 | |
---|---|
name |
String |
setDeviceWaitTime
public void setDeviceWaitTime (int waitTime)
設定裝置上線的等待時間 (以秒為單位),然後嘗試擷取錯誤報告。如果為否,則不會執行檢查。系統會記錄並忽略檢查期間遇到的任何 DeviceNotAvailableException
。
參數 | |
---|---|
waitTime |
int |
testAssumptionFailure
public void testAssumptionFailure (TestDescription test, String trace)
參數 | |
---|---|
test |
TestDescription |
trace |
String |
testEnded
public void testEnded (TestDescription test,testMetrics)
參數 | |
---|---|
test |
TestDescription |
testMetrics |
|
testFailed
public void testFailed (TestDescription test, String trace)
參數 | |
---|---|
test |
TestDescription |
trace |
String |
testIgnored
public void testIgnored (TestDescription test)
參數 | |
---|---|
test |
TestDescription |
testLog
public void testLog (String dataName, LogDataType dataType, InputStreamSource dataStream)
參數 | |
---|---|
dataName |
String |
dataType |
LogDataType |
dataStream |
InputStreamSource |
testRunEnded
public void testRunEnded (long elapsedTime,runMetrics)
參數 | |
---|---|
elapsedTime |
long |
runMetrics |
|
testRunFailed
public void testRunFailed (String errorMessage)
參數 | |
---|---|
errorMessage |
String |
testRunStarted
public void testRunStarted (String runName, int testCount)
參數 | |
---|---|
runName |
String |
testCount |
int |
testRunStopped
public void testRunStopped (long elapsedTime)
參數 | |
---|---|
elapsedTime |
long |
testStarted
public void testStarted (TestDescription test)
參數 | |
---|---|
test |
TestDescription |