ExecutableBaseTest
public
abstract
class
ExecutableBaseTest
extends Object
implements
IAbiReceiver,
IConfigurationReceiver,
IDiscoverDependencies,
IRemoteTest,
IRuntimeHintProvider,
IShardableTest,
ITestCollector,
ITestFilterReceiver
| java.lang.Object | |
| ↳ | com.android.tradefed.testtype.binary.ExecutableBaseTest |
可執行式測試樣式的基礎類別。例如:二進位檔、殼層指令碼。
摘要
欄位 | |
|---|---|
public
static
final
String |
NO_BINARY_ERROR
|
公用建構函式 | |
|---|---|
ExecutableBaseTest()
|
|
公用方法 | |
|---|---|
void
|
addAllExcludeFilters(
新增篩選器的 |
void
|
addAllIncludeFilters(
新增篩選器的 |
void
|
addExcludeFilter(String filter)
新增篩選器,用於排除要排除的測試。 |
void
|
addIncludeFilter(String filter)
新增篩選器,用於篩選要納入的測試。 |
void
|
clearExcludeFilters()
刪除目前追蹤的所有排除篩選條件。 |
void
|
clearIncludeFilters()
刪除目前追蹤的所有包含篩選器。 |
abstract
String
|
findBinary(String binary)
搜尋可執行的二進位檔。 |
IAbi
|
getAbi()
|
boolean
|
getCollectTestsOnly()
|
|
getExcludeFilters()
傳回排除篩選器的目前 |
|
getIncludeFilters()
傳回目前的包含篩選器 |
final
long
|
getRuntimeHint()
以毫秒為單位,傳回測試的預期執行時間。 |
|
reportDependencies()
|
void
|
run(TestInformation testInfo, ITestInvocationListener listener)
執行測試,並將結果回報給監聽器。 |
abstract
void
|
runBinary(String binaryPath, ITestInvocationListener listener, TestDescription description)
實際在指定路徑上執行二進位檔。 |
final
void
|
setAbi(IAbi abi)
|
final
void
|
setCollectTestsOnly(boolean shouldCollectTest)
啟用或停用測試收集模式 |
void
|
setConfiguration(IConfiguration configuration)
插入正在使用的 |
FailureDescription
|
shouldAbortRun(TestDescription description)
檢查 testRun 是否應提前結束。 |
final
|
split(int shardHint)
|
受保護的方法 | |
|---|---|
boolean
|
doesRunBinaryGenerateTestResults()
|
boolean
|
doesRunBinaryGenerateTestRuns()
|
|
getAllTestCommands()
為求一致,請將 mBinaryPaths 轉換為 mTestCommands。 |
IConfiguration
|
getConfiguration()
傳回測試設定。 |
TestDescription[]
|
getFilterDescriptions(
|
String
|
getModuleId(IInvocationContext context)
|
long
|
getTimeoutPerBinaryMs()
|
boolean
|
isTestFailed(String testName)
|
欄位
NO_BINARY_ERROR
public static final String NO_BINARY_ERROR
公用建構函式
ExecutableBaseTest
public ExecutableBaseTest ()
公用方法
addAllExcludeFilters
public void addAllExcludeFilters (filters)
新增篩選器的 ERROR(/Set),用於排除要排除的測試。
| 參數 | |
|---|---|
filters |
|
addAllIncludeFilters
public void addAllIncludeFilters (filters)
新增篩選器的 ERROR(/Set),用於指定要納入哪些測試。
| 參數 | |
|---|---|
filters |
|
addExcludeFilter
public void addExcludeFilter (String filter)
新增篩選器,用於排除要排除的測試。
| 參數 | |
|---|---|
filter |
String |
addIncludeFilter
public void addIncludeFilter (String filter)
新增篩選器,用於篩選要納入的測試。
| 參數 | |
|---|---|
filter |
String |
clearExcludeFilters
public void clearExcludeFilters ()
刪除目前追蹤的所有排除篩選條件。
clearIncludeFilters
public void clearIncludeFilters ()
刪除目前追蹤的所有包含篩選器。
findBinary
public abstract String findBinary (String binary)
搜尋可執行的二進位檔。
| 參數 | |
|---|---|
binary |
String:二進位檔的路徑或二進位檔名稱。 |
| 傳回 | |
|---|---|
String |
二進位檔案的路徑,如果找不到則傳回 null。 |
| 擲回 | |
|---|---|
DeviceNotAvailableException |
|
getCollectTestsOnly
public boolean getCollectTestsOnly ()
| 傳回 | |
|---|---|
boolean |
|
getRuntimeHint
public final long getRuntimeHint ()
以毫秒為單位,傳回測試的預期執行時間。這段時間用於負載平衡分割執行作業
| 傳回 | |
|---|---|
long |
|
reportDependencies
publicreportDependencies ()
| 傳回 | |
|---|---|
|
|
得分
public void run (TestInformation testInfo, ITestInvocationListener listener)
執行測試,並將結果回報給監聽器。
| 參數 | |
|---|---|
testInfo |
TestInformation:包含執行測試所需實用資訊的 TestInformation 物件。 |
listener |
ITestInvocationListener:測試結果的 ITestInvocationListener |
| 擲回 | |
|---|---|
DeviceNotAvailableException |
|
runBinary
public abstract void runBinary (String binaryPath,
ITestInvocationListener listener,
TestDescription description)實際在指定路徑中執行二進位檔。
| 參數 | |
|---|---|
binaryPath |
String:二進位檔的路徑。 |
listener |
ITestInvocationListener:用於回報結果的事件監聽器。 |
description |
TestDescription:測試中。 |
| 擲回 | |
|---|---|
DeviceNotAvailableException |
|
setCollectTestsOnly
public final void setCollectTestsOnly (boolean shouldCollectTest)
啟用或停用測試收集模式
setConfiguration
public void setConfiguration (IConfiguration configuration)
插入正在使用的 IConfiguration。
| 參數 | |
|---|---|
configuration |
IConfiguration |
shouldAbortRun
public FailureDescription shouldAbortRun (TestDescription description)
檢查是否應提早結束測試執行作業。
| 參數 | |
|---|---|
description |
TestDescription:測試中。 |
| 傳回 | |
|---|---|
FailureDescription |
若執行迴圈應終止,則為 FailureDescription。 |
拆分
public finalsplit (int shardHint)
split() 的替代版本,同時提供嘗試執行的區塊計數。這對某些無法隨意決定的測試執行程式相當實用。
| 參數 | |
|---|---|
shardHint |
int:嘗試的分割區數量。 |
| 傳回 | |
|---|---|
|
要個別執行的子測試集合,或如果測試目前無法分割,則為 null |
受保護的方法
doesRunBinaryGenerateTestResults
protected boolean doesRunBinaryGenerateTestResults ()
| 傳回 | |
|---|---|
boolean |
|
doesRunBinaryGenerateTestRuns
protected boolean doesRunBinaryGenerateTestRuns ()
| 傳回 | |
|---|---|
boolean |
|
getAllTestCommands
protectedgetAllTestCommands ()
為求一致,請將 mBinaryPaths 轉換為 mTestCommands。
| 傳回 | |
|---|---|
|
包含 testCommands 的 MapERROR(/LinkedHashMap)<string, string="">。</string> |
getConfiguration
protected IConfiguration getConfiguration ()
傳回測試設定。
| 傳回 | |
|---|---|
IConfiguration |
IConfiguration |
getFilterDescriptions
protected TestDescription[] getFilterDescriptions (testCommands)
| 參數 | |
|---|---|
testCommands |
|
| 傳回 | |
|---|---|
TestDescription[] |
|
getModuleId
protected String getModuleId (IInvocationContext context)
| 參數 | |
|---|---|
context |
IInvocationContext |
| 傳回 | |
|---|---|
String |
|
getTimeoutPerBinaryMs
protected long getTimeoutPerBinaryMs ()
| 傳回 | |
|---|---|
long |
套用至每個二進位檔執行作業的逾時值。 |
isTestFailed
protected boolean isTestFailed (String testName)
| 參數 | |
|---|---|
testName |
String |
| 傳回 | |
|---|---|
boolean |
|