IsolatedHostTest
public
class
IsolatedHostTest
extends Object
implements
IBuildReceiver,
IConfigurationReceiver,
IRemoteTest,
ITestAnnotationFilterReceiver,
ITestCollector,
ITestFilterReceiver
java.lang.Object | |
↳ | com.android.tradefed.testtype.IsolatedHostTest |
实现了 TradeFed 运行程序,该运行程序使用子进程在依赖项较少的环境中执行测试,而不是在主进程中执行测试。
此运行程序假定所有配置的 jar 都在同一测试目录中,并在该目录中启动子进程。由于它必须为子进程选择一个工作目录,而许多测试都受益于该目录是测试目录,因此这是可用的最佳折衷方案。
摘要
公共构造函数 | |
---|---|
IsolatedHostTest()
|
公共方法 | |
---|---|
void
|
addAllExcludeAnnotation(
添加了 |
void
|
addAllExcludeFilters(
添加了要排除的测试的过滤条件的 |
void
|
addAllIncludeAnnotation(
添加了 |
void
|
addAllIncludeFilters(
添加要包含的测试的过滤条件的 |
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
|
compileLdLibraryPathInner(String androidHostOut)
我们从单元测试调用此版本,并直接传递 ANDROID_HOST_OUT。 |
File
|
getJarFile(String jarName, TestInformation testInfo)
从 HostTest 复制过来,以模仿其单元测试框架。 |
void
|
setServer(ServerSocket server)
|
公共构造函数
IsolatedHostTest
public IsolatedHostTest ()
公共方法
addAllExcludeAnnotation
public void addAllExcludeAnnotation (notAnnotations)
添加了 ERROR(/Set)
注解,以便在测试被标记为包含该注解时进行排除。
参数 | |
---|---|
notAnnotations |
|
addAllExcludeFilters
public void addAllExcludeFilters (filters)
添加了要排除的测试的过滤条件的 ERROR(/Set)
。
参数 | |
---|---|
filters |
|
addAllIncludeAnnotation
public void addAllIncludeAnnotation (annotations)
添加了 ERROR(/Set)
注解,以便在测试被标记为包含该注解时进行包含。
参数 | |
---|---|
annotations |
|
addAllIncludeFilters
public void addAllIncludeFilters (filters)
添加了要包含的测试的过滤条件的 ERROR(/Set)
。
参数 | |
---|---|
filters |
|
addExcludeAnnotation
public void addExcludeAnnotation (String notAnnotation)
添加了注解,用于排除被标记为包含该注解的测试。
参数 | |
---|---|
notAnnotation |
String |
addExcludeFilter
public void addExcludeFilter (String filter)
添加了用于过滤要排除的测试的过滤条件。
参数 | |
---|---|
filter |
String |
addIncludeAnnotation
public void addIncludeAnnotation (String annotation)
添加了注解,以便在测试被标记时包含该注解。
参数 | |
---|---|
annotation |
String |
addIncludeFilter
public void addIncludeFilter (String filter)
添加了用于过滤要包含的测试的过滤条件。
参数 | |
---|---|
filter |
String |
clearExcludeAnnotations
public void clearExcludeAnnotations ()
删除当前跟踪的所有排除注释。
clearExcludeFilters
public void clearExcludeFilters ()
删除当前跟踪的所有排除过滤条件。
clearIncludeAnnotations
public void clearIncludeAnnotations ()
删除当前跟踪的所有包含注释。
clearIncludeFilters
public void clearIncludeFilters ()
删除当前跟踪的所有包含过滤条件。
compileClassPath
public String compileClassPath ()
为子进程创建一个包含运行测试所需 jar 文件的类路径
返回 | |
---|---|
String |
一个字符串,用于指定以冒号分隔的类路径。 |
compileCommandArgs
publiccompileCommandArgs (String classpath, File artifactsDir)
组装命令参数以执行子进程运行程序。
参数 | |
---|---|
classpath |
String |
artifactsDir |
File |
返回 | |
---|---|
|
deleteTempFiles
public void deleteTempFiles ()
getCoverageExecFile
public File getCoverageExecFile ()
返回 | |
---|---|
File |
得分
public void run (TestInformation testInfo, ITestInvocationListener listener)
运行测试并向监听器报告结果。
参数 | |
---|---|
testInfo |
TestInformation :包含运行测试的实用信息的 TestInformation 对象。 |
listener |
ITestInvocationListener :测试结果的 ITestInvocationListener |
抛出 | |
---|---|
DeviceNotAvailableException |
setCollectTestsOnly
public void setCollectTestsOnly (boolean shouldCollectTest)
启用或停用测试集合模式
setConfiguration
public void setConfiguration (IConfiguration configuration)
注入正在使用的 IConfiguration
。
参数 | |
---|---|
configuration |
IConfiguration |
setDebug
public void setDebug (boolean debug)
参数 | |
---|---|
debug |
boolean |
uploadTestArtifacts
public void uploadTestArtifacts (File logDir, ITestInvocationListener listener)
参数 | |
---|---|
logDir |
File |
listener |
ITestInvocationListener |
useRavenwoodResources
public boolean useRavenwoodResources ()
返回 | |
---|---|
boolean |
useRobolectricResources
public boolean useRobolectricResources ()
返回 | |
---|---|
boolean |
受保护的方法
compileLdLibraryPathInner
protected String compileLdLibraryPathInner (String androidHostOut)
我们从单元测试调用此版本,并直接传递 ANDROID_HOST_OUT。我们需要它,因为 Java 没有用于设置环境变量的 API。
参数 | |
---|---|
androidHostOut |
String |
返回 | |
---|---|
String |
getJarFile
protected File getJarFile (String jarName, TestInformation testInfo)
从 HostTest 复制过来,以模仿其单元测试框架。
检查不同用例的多个工件通常位于的位置,以查找我们的 jar。
参数 | |
---|---|
jarName |
String |
testInfo |
TestInformation |
返回 | |
---|---|
File |
setServer
protected void setServer (ServerSocket server)
参数 | |
---|---|
server |
ServerSocket |