隔离主机测试
public class IsolatedHostTest
extends Object
implements IRemoteTest , IBuildReceiver , ITestAnnotationFilterReceiver , ITestFilterReceiver , IConfigurationReceiver , ITestCollector
java.lang.Object | |
↳ | com.android.tradefed.testtype.IsolatedHostTest |
实现 TradeFed 运行程序,该运行程序使用子进程在低依赖性环境中执行测试,而不是在主进程上执行测试。
该运行程序假设配置的所有 jar 都位于同一测试目录中,并在该目录中启动子进程。由于它必须为子进程选择一个工作目录,并且许多测试受益于该目录作为测试目录,因此这是可用的最佳折衷方案。
概括
公共构造函数 | |
---|---|
IsolatedHostTest () |
公共方法 | |
---|---|
void | addAllExcludeAnnotation ( notAnnotations) addAllExcludeAnnotation ( notAnnotations) 添加 |
void | addAllExcludeFilters ( filters) addAllExcludeFilters ( filters) 添加要排除的测试的过滤器的 |
void | addAllIncludeAnnotation ( annotations) addAllIncludeAnnotation ( annotations) 添加 |
void | addAllIncludeFilters ( filters) addAllIncludeFilters ( filters) 添加要包含的测试的过滤器的 |
void | addExcludeAnnotation (String notAnnotation) 添加注释以排除测试是否用它标记。 |
void | addExcludeFilter (String filter) 添加要排除的测试的过滤器。 |
void | addIncludeAnnotation (String annotation) 添加注释以包含测试是否用它标记。 |
void | addIncludeFilter (String filter) 添加要包含的测试的过滤器。 |
void | clearExcludeAnnotations () 删除当前跟踪的所有排除注释。 |
void | clearExcludeFilters () 删除当前跟踪的所有排除过滤器。 |
void | clearIncludeAnnotations () 删除当前跟踪的所有包含注释。 |
void | clearIncludeFilters () 删除当前跟踪的所有包含过滤器。 |
String | compileClassPath () 为子进程创建一个类路径,其中包含运行测试所需的 jar |
compileCommandArgs (String classpath, File artifactsDir) 组装命令参数以执行子进程运行程序。 | |
void | deleteTempFiles () |
File | getCoverageExecFile () |
getExcludeAnnotations () 返回要排除的注释的当前 | |
getExcludeFilters () 返回排除过滤器的当前 | |
getIncludeAnnotations () 返回要包含的注释的当前 | |
getIncludeFilters () 返回包含过滤器的当前 | |
void | run ( TestInformation testInfo, ITestInvocationListener listener) 运行测试,并将结果报告给侦听器。 |
void | setBuild ( IBuildInfo build) |
void | setCollectTestsOnly (boolean shouldCollectTest) 启用或禁用测试收集模式 |
void | setConfiguration ( IConfiguration configuration) 注入正在使用的 |
void | setDebug (boolean debug) |
void | uploadTestArtifacts (File logDir, ITestInvocationListener listener) |
boolean | useRavenwoodResources () |
boolean | useRobolectricResources () |
受保护的方法 | |
---|---|
String | compileLdLibraryPath () 对于需要本机库的测试,返回 LD_LIBRARY_PATH。 |
File | getJarFile (String jarName, TestInformation testInfo) 从 HostTest 复制来模仿其单元测试利用。 |
void | setServer (ServerSocket server) |
公共构造函数
隔离主机测试
public IsolatedHostTest ()
公共方法
添加全部排除注释
public void addAllExcludeAnnotation (notAnnotations)
添加ERROR(/Set)
注释以排除测试是否用它标记。
参数 | |
---|---|
notAnnotations |
添加排除注释
public void addExcludeAnnotation (String notAnnotation)
添加注释以排除测试是否用它标记。
参数 | |
---|---|
notAnnotation | String |
添加排除过滤器
public void addExcludeFilter (String filter)
添加要排除的测试的过滤器。
参数 | |
---|---|
filter | String |
添加包含注释
public void addIncludeAnnotation (String annotation)
添加注释以包含测试是否用它标记。
参数 | |
---|---|
annotation | String |
添加包含过滤器
public void addIncludeFilter (String filter)
添加要包含的测试的过滤器。
参数 | |
---|---|
filter | String |
清除排除注释
public void clearExcludeAnnotations ()
删除当前跟踪的所有排除注释。
清除排除过滤器
public void clearExcludeFilters ()
删除当前跟踪的所有排除过滤器。
清除包含注释
public void clearIncludeAnnotations ()
删除当前跟踪的所有包含注释。
清除包含过滤器
public void clearIncludeFilters ()
删除当前跟踪的所有包含过滤器。
编译类路径
public String compileClassPath ()
为子进程创建一个类路径,其中包含运行测试所需的 jar
退货 | |
---|---|
String | 指定用冒号分隔的类路径的字符串。 |
编译命令参数
publiccompileCommandArgs (String classpath, File artifactsDir)
组装命令参数以执行子进程运行程序。
参数 | |
---|---|
classpath | String |
artifactsDir | File |
退货 | |
---|---|
删除临时文件
public void deleteTempFiles ()
获取覆盖执行文件
public File getCoverageExecFile ()
退货 | |
---|---|
File |
跑步
public void run (TestInformation testInfo, ITestInvocationListener listener)
运行测试,并将结果报告给侦听器。
参数 | |
---|---|
testInfo | TestInformation : TestInformation 对象包含运行测试的有用信息。 |
listener | ITestInvocationListener :测试结果的ITestInvocationListener |
投掷 | |
---|---|
DeviceNotAvailableException |
仅设置收集测试
public void setCollectTestsOnly (boolean shouldCollectTest)
启用或禁用测试收集模式
设置配置
public void setConfiguration (IConfiguration configuration)
注入正在使用的IConfiguration
。
参数 | |
---|---|
configuration | IConfiguration |
设置调试
public void setDebug (boolean debug)
参数 | |
---|---|
debug | boolean |
上传测试工件
public void uploadTestArtifacts (File logDir, ITestInvocationListener listener)
参数 | |
---|---|
logDir | File |
listener | ITestInvocationListener |
使用Ravenwood资源
public boolean useRavenwoodResources ()
退货 | |
---|---|
boolean |
使用RobolectricResources
public boolean useRobolectricResources ()
退货 | |
---|---|
boolean |
受保护的方法
编译Ld库路径
protected String compileLdLibraryPath ()
对于需要本机库的测试,返回 LD_LIBRARY_PATH。
退货 | |
---|---|
String | 指定用冒号分隔的库路径的字符串。 |
获取Jar文件
protected File getJarFile (String jarName, TestInformation testInfo)
从 HostTest 复制来模仿其单元测试利用。
检查不同用例中工件通常所在的几个位置以找到我们的 jar。
参数 | |
---|---|
jarName | String |
testInfo | TestInformation |
退货 | |
---|---|
File |
设置服务器
protected void setServer (ServerSocket server)
参数 | |
---|---|
server | ServerSocket |