TestFilterHelper

public class TestFilterHelper
extends Object

java.lang.Object
   ↳ com.android.tradefed.util.TestFilterHelper


用于过滤测试的辅助类

摘要

公共构造函数

TestFilterHelper()
TestFilterHelper(Collection<String> includeFilters, Collection<String> excludeFilters, Collection<String> includeAnnotation, Collection<String> excludeAnnotation)

公共方法

void addAllExcludeAnnotation(Set<String> notAnnotations)

添加要运行的测试的排除注释Set

void addAllExcludeFilters(Set<String> filters)

添加用于指定要排除哪些测试的过滤条件Set

void addAllIncludeAnnotation(Set<String> annotations)

添加要运行的测试的包含注释的 Set

void addAllIncludeFilters(Set<String> filters)

添加用于指定要包含哪些测试的过滤条件Set

void addExcludeAnnotation(String notAnnotation)

添加了要运行的测试的排除注解

void addExcludeFilter(String filter)

添加用于指定要排除哪些测试的过滤条件

void addIncludeAnnotation(String annotation)

添加了要运行的测试的 include 注释

void addIncludeFilter(String filter)

添加用于指定要包含哪些测试的过滤条件

void clearExcludeAnnotations()
void clearExcludeFilters()
void clearIncludeAnnotations()
void clearIncludeFilters()
Set<String> getExcludeAnnotation()
Set<String> getExcludeFilters()
Set<String> getIncludeAnnotation()
Set<String> getIncludeFilters()
boolean shouldRun(Description desc, List<File> extraJars)

检查具有注释的元素是否通过了过滤条件

boolean shouldRun(String packageName, Class<?> classObj, Method method)

检查具有注释的元素是否通过了过滤条件

boolean shouldTestRun(AnnotatedElement annotatedElement)

检查具有注释的元素是否通过了过滤条件

boolean shouldTestRun(Description desc)

检查包含注释的 Description 是否通过了过滤条件

公共构造函数

TestFilterHelper

public TestFilterHelper ()

TestFilterHelper

public TestFilterHelper (Collection<String> includeFilters, 
                Collection<String> excludeFilters, 
                Collection<String> includeAnnotation, 
                Collection<String> excludeAnnotation)

参数
includeFilters Collection

excludeFilters Collection

includeAnnotation Collection

excludeAnnotation Collection

公共方法

addAllExcludeAnnotation

public void addAllExcludeAnnotation (Set<String> notAnnotations)

添加要运行的测试的排除注释Set

参数
notAnnotations Set

addAllExcludeFilters

public void addAllExcludeFilters (Set<String> filters)

添加用于指定要排除哪些测试的过滤条件Set

参数
filters Set

addAllIncludeAnnotation

public void addAllIncludeAnnotation (Set<String> annotations)

添加了要运行的测试的包含注释的 Set

参数
annotations Set

addAllIncludeFilters

public void addAllIncludeFilters (Set<String> filters)

添加用于指定要包含哪些测试的过滤条件Set

参数
filters Set

addExcludeAnnotation

public void addExcludeAnnotation (String notAnnotation)

添加了要运行的测试的排除注解

参数
notAnnotation String

addExcludeFilter

public void addExcludeFilter (String filter)

添加用于指定要排除哪些测试的过滤条件

参数
filter String

addIncludeAnnotation

public void addIncludeAnnotation (String annotation)

添加了要运行的测试的 include 注释

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

getExcludeAnnotation

public Set<String> getExcludeAnnotation ()

返回
Set<String>

getExcludeFilters

public Set<String> getExcludeFilters ()

返回
Set<String>

getIncludeAnnotation

public Set<String> getIncludeAnnotation ()

返回
Set<String>

getIncludeFilters

public Set<String> getIncludeFilters ()

返回
Set<String>

shouldRun

public boolean shouldRun (Description desc, 
                List<File> extraJars)

检查具有注释的元素是否通过了过滤条件

参数
desc Description:描述测试的 Description

extraJars List:指向要加载的额外 jar 的 File 列表。

返回
boolean 如果应运行测试方法,则为 true;否则为 false

shouldRun

public boolean shouldRun (String packageName, 
                Class<?> classObj, 
                Method method)

检查具有注释的元素是否通过了过滤条件

参数
packageName String:方法的软件包名称

classObj Class:方法所属的类

method Method:测试方法

返回
boolean 如果应运行测试方法,则为 true;否则为 false

shouldTestRun

public boolean shouldTestRun (AnnotatedElement annotatedElement)

检查具有注释的元素是否通过了过滤条件

参数
annotatedElement AnnotatedElement:要过滤的元素

返回
boolean 如果应运行测试,则为 true,否则为 false

shouldTestRun

public boolean shouldTestRun (Description desc)

检查包含注释的 Description 是否通过了过滤条件

参数
desc Description:要过滤的元素

返回
boolean 如果应运行测试,则为 true,否则为 false