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 |
可执行式测试样式的基类。例如:二进制文件、shell 脚本。
摘要
字段 | |
|---|---|
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)
检查 testRun 是否应提前结束。
| 参数 | |
|---|---|
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 |
|