隔离主机测试

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)

添加一个ERROR(/Set)注释以排除是否测试是否用它标记。

void addAllExcludeFilters ( filters) addAllExcludeFilters ( filters)

添加要排除的测试的过滤器的ERROR(/Set)

void addAllIncludeAnnotation ( annotations) addAllIncludeAnnotation ( annotations)

添加一个ERROR(/Set)注释以包含是否测试是否用它标记。

void addAllIncludeFilters ( filters) addAllIncludeFilters ( filters)

添加要包含哪些测试的过滤器的ERROR(/Set)

void addExcludeAnnotation (String notAnnotation)

添加注释以排除是否测试是否用它标记。

void addExcludeFilter (String filter)

添加要排除哪些测试的过滤器。

void addIncludeAnnotation (String annotation)

添加一个注释以包含如果一个测试是否用它标记。

void addIncludeFilter (String filter)

添加要包含哪些测试的过滤器。

void clearExcludeAnnotations ()

删除当前跟踪的所有排除注释。

void clearExcludeFilters ()

删除当前跟踪的所有排除过滤器。

void clearIncludeAnnotations ()

删除当前跟踪的所有包含注释。

void clearIncludeFilters ()

删除当前跟踪的所有包含过滤器。

compileCommandArgs (String classpath, File artifactsDir)

组装命令参数以执行子进程运行器。

File getCoverageExecFile ()
getExcludeAnnotations ()

返回要排除的注释的当前ERROR(/Set)

getExcludeFilters ()

返回排除过滤器的当前ERROR(/Set)

getIncludeAnnotations ()

返回要包含的注释的当前ERROR(/Set)

getIncludeFilters ()

返回包含过滤器的当前ERROR(/Set)

void run ( TestInformation testInfo, ITestInvocationListener listener)

运行测试,并将结果报告给侦听器。

void setBuild ( IBuildInfo build)

void setCollectTestsOnly (boolean shouldCollectTest)

启用或禁用测试收集模式

void setConfiguration ( IConfiguration configuration)

注入正在使用的IConfiguration

void setDebug (boolean debug)
void uploadTestArtifacts (File logDir, ITestInvocationListener listener)
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 addAllExcludeFilters ( filters)

添加要排除的测试的过滤器的ERROR(/Set)

参数
filters

addAllIncludeAnnotation

public void addAllIncludeAnnotation ( annotations)

添加一个ERROR(/Set)注释以包含是否测试是否用它标记。

参数
annotations

添加所有包含过滤器

public void addAllIncludeFilters ( filters)

添加要包含哪些测试的过滤器的ERROR(/Set)

参数
filters

添加排除注解

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 ()

删除当前跟踪的所有排除过滤器。

clearIncludeAnnotations

public void clearIncludeAnnotations ()

删除当前跟踪的所有包含注释。

清除包含过滤器

public void clearIncludeFilters ()

删除当前跟踪的所有包含过滤器。

compileCommandArgs

public  compileCommandArgs (String classpath, 
                File artifactsDir)

组装命令参数以执行子进程运行器。

参数
classpath String

artifactsDir File

退货

getCoverageExecFile

public File getCoverageExecFile ()

退货
File

getExcludeAnnotations

public  getExcludeAnnotations ()

返回要排除的注释的当前ERROR(/Set)

退货

获取排除过滤器

public  getExcludeFilters ()

返回排除过滤器的当前ERROR(/Set)

退货

getIncludeAnnotations

public  getIncludeAnnotations ()

返回要包含的注释的当前ERROR(/Set)

退货

getIncludeFilters

public  getIncludeFilters ()

返回包含过滤器的当前ERROR(/Set)

退货

跑步

public void run (TestInformation testInfo, 
                ITestInvocationListener listener)

运行测试,并将结果报告给侦听器。

参数
testInfo TestInformation :包含运行测试的有用信息的TestInformation对象。

listener ITestInvocationListener : 测试结果的ITestInvocationListener

投掷
DeviceNotAvailableException

设置构建

public void setBuild (IBuildInfo build)

参数
build IBuildInfo

setCollectTestsOnly

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

使用 RobolectricResources

public boolean useRobolectricResources ()

退货
boolean

受保护的方法

compileLdLibraryPath

protected String compileLdLibraryPath ()

为需要本机库的测试返回 LD_LIBRARY_PATH。

退货
String指定以冒号分隔的库路径的字符串。

获取JarFile

protected File getJarFile (String jarName, 
                TestInformation testInfo)

从 HostTest 复制过来以模仿其单元测试利用。

检查工件通常位于不同用例的几个位置以找到我们的 jar。

参数
jarName String

testInfo TestInformation

退货
File

设置服务器

protected void setServer (ServerSocket server)

参数
server ServerSocket