可執行基礎測試
public abstract class ExecutableBaseTest
extends Object
implements IRemoteTest , IRuntimeHintProvider , ITestCollector , IShardableTest , IAbiReceiver , ITestFilterReceiver , IDiscoverDependencies
java.lang.Object | |
↳ | com.android.tradefed.testtype.binary.ExecutableBaseTest |
可執行測試風格的基底類別。例如:二進位檔案、shell 腳本。
概括
領域 | |
---|---|
public static final String | NO_BINARY_ERROR
|
公共構造函數 | |
---|---|
ExecutableBaseTest () |
公共方法 | |
---|---|
void | addAllExcludeFilters ( filters) addAllExcludeFilters ( filters) 新增要排除的測試的過濾器的 |
void | addAllIncludeFilters ( filters) addAllIncludeFilters ( filters) 新增要包含的測試的過濾器的 |
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) 啟用或停用測試收集模式 |
final | split (int shardHint) |
受保護的方法 | |
---|---|
boolean | doesRunBinaryGenerateTestResults () |
TestDescription[] | getFilterDescriptions ( testCommands) getFilterDescriptions ( testCommands) |
String | getModuleId ( IInvocationContext context) |
long | getTimeoutPerBinaryMs () |
領域
無二進位錯誤
public static final String NO_BINARY_ERROR
公共構造函數
可執行基礎測試
public ExecutableBaseTest ()
公共方法
新增排除過濾器
public void addExcludeFilter (String filter)
新增要排除的測試的過濾器。
參數 | |
---|---|
filter | String |
新增包含過濾器
public void addIncludeFilter (String filter)
新增要包含的測試的過濾器。
參數 | |
---|---|
filter | String |
清除排除過濾器
public void clearExcludeFilters ()
刪除目前追蹤的所有排除過濾器。
清除包含過濾器
public void clearIncludeFilters ()
刪除目前追蹤的所有包含過濾器。
尋找二進位文件
public abstract String findBinary (String binary)
搜尋二進位檔案以便能夠運行它。
參數 | |
---|---|
binary | String :二進位檔案的路徑或簡單的二進位檔案名稱。 |
退貨 | |
---|---|
String | 二進位檔案的路徑,如果未找到則為 null。 |
投擲 | |
---|---|
DeviceNotAvailableException |
僅獲取收集測試
public boolean getCollectTestsOnly ()
退貨 | |
---|---|
boolean |
取得運行時提示
public final long getRuntimeHint ()
傳回測試的預期運行時間(以毫秒為單位)。此時間用於負載平衡分片執行
退貨 | |
---|---|
long |
報告依賴關係
publicreportDependencies ()
退貨 | |
---|---|
跑步
public void run (TestInformation testInfo, ITestInvocationListener listener)
運行測試,並將結果報告給偵聽器。
參數 | |
---|---|
testInfo | TestInformation : TestInformation 物件包含執行測試的有用資訊。 |
listener | ITestInvocationListener :測試結果的ITestInvocationListener |
投擲 | |
---|---|
DeviceNotAvailableException |
運行二進位文件
public abstract void runBinary (String binaryPath, ITestInvocationListener listener, TestDescription description)
實際上在給定路徑上運行二進位檔案。
參數 | |
---|---|
binaryPath | String :二進位檔案的路徑。 |
listener | ITestInvocationListener :報告結果的偵聽器。 |
description | TestDescription :測試正在進行中。 |
投擲 | |
---|---|
DeviceNotAvailableException |
僅設定收集測試
public final void setCollectTestsOnly (boolean shouldCollectTest)
啟用或停用測試收集模式
分裂
public finalsplit (int shardHint)
split()
的替代版本還提供嘗試運行的 shardCount。這對於某些有時無法隨意決定的測試運行者很有用。
參數 | |
---|---|
shardHint | int :嘗試的分片計數。 |
退貨 | |
---|---|
要單獨執行的子測試的集合,如果測試目前不可分片,則為null |
受保護的方法
doesRunBinary產生測試結果
protected boolean doesRunBinaryGenerateTestResults ()
退貨 | |
---|---|
boolean |
取得過濾器描述
protected TestDescription[] getFilterDescriptions (testCommands)
參數 | |
---|---|
testCommands |
退貨 | |
---|---|
TestDescription[] |
取得模組ID
protected String getModuleId (IInvocationContext context)
參數 | |
---|---|
context | IInvocationContext |
退貨 | |
---|---|
String |
getTimeoutPerBinaryMs
protected long getTimeoutPerBinaryMs ()
退貨 | |
---|---|
long | 應用於每個二進位檔案執行的逾時。 |