TestFilterHelper

public class TestFilterHelper
extends Object

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


Helper class for filtering tests

Summary

Public constructors

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

Public methods

void addAllExcludeAnnotation(Set<String> notAnnotations)

Adds the Set of exclude annotation of the test to run

void addAllExcludeFilters(Set<String> filters)

Adds the Set of filters of which tests to exclude.

void addAllIncludeAnnotation(Set<String> annotations)

Adds the Set of include annotation of the test to run

void addAllIncludeFilters(Set<String> filters)

Adds the Set of filters of which tests to include

void addExcludeAnnotation(String notAnnotation)

Adds an exclude annotation of the test to run

void addExcludeFilter(String filter)

Adds a filter of which tests to exclude

void addIncludeAnnotation(String annotation)

Adds an include annotation of the test to run

void addIncludeFilter(String filter)

Adds a filter of which tests to include

Set<String> getExcludeAnnotation()
Set<String> getExcludeFilters()
Set<String> getIncludeAnnotation()
Set<String> getIncludeFilters()
boolean shouldRun(String packageName, Class<?> classObj, Method method)

Check if an element that has annotation passes the filter

boolean shouldRun(Description desc)

Check if an element that has annotation passes the filter

boolean shouldTestRun(AnnotatedElement annotatedElement)

Check if an element that has annotation passes the filter

boolean shouldTestRun(Description desc)

Check if the Description that contains annotations passes the filter

Public constructors

TestFilterHelper

TestFilterHelper ()

TestFilterHelper

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

Parameters
includeFilters Collection
excludeFilters Collection
includeAnnotation Collection
excludeAnnotation Collection

Public methods

addAllExcludeAnnotation

void addAllExcludeAnnotation (Set<String> notAnnotations)

Adds the Set of exclude annotation of the test to run

Parameters
notAnnotations Set

addAllExcludeFilters

void addAllExcludeFilters (Set<String> filters)

Adds the Set of filters of which tests to exclude.

Parameters
filters Set

addAllIncludeAnnotation

void addAllIncludeAnnotation (Set<String> annotations)

Adds the Set of include annotation of the test to run

Parameters
annotations Set

addAllIncludeFilters

void addAllIncludeFilters (Set<String> filters)

Adds the Set of filters of which tests to include

Parameters
filters Set

addExcludeAnnotation

void addExcludeAnnotation (String notAnnotation)

Adds an exclude annotation of the test to run

Parameters
notAnnotation String

addExcludeFilter

void addExcludeFilter (String filter)

Adds a filter of which tests to exclude

Parameters
filter String

addIncludeAnnotation

void addIncludeAnnotation (String annotation)

Adds an include annotation of the test to run

Parameters
annotation String

addIncludeFilter

void addIncludeFilter (String filter)

Adds a filter of which tests to include

Parameters
filter String

getExcludeAnnotation

Set<String> getExcludeAnnotation ()

Returns
Set<String>

getExcludeFilters

Set<String> getExcludeFilters ()

Returns
Set<String>

getIncludeAnnotation

Set<String> getIncludeAnnotation ()

Returns
Set<String>

getIncludeFilters

Set<String> getIncludeFilters ()

Returns
Set<String>

shouldRun

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

Check if an element that has annotation passes the filter

Parameters
packageName String: name of the method's package
classObj Class: method's class
method Method: test method
Returns
boolean true if the test method should run, false otherwise

shouldRun

boolean shouldRun (Description desc)

Check if an element that has annotation passes the filter

Parameters
desc Description: a Description that describes the test.
Returns
boolean true if the test method should run, false otherwise

shouldTestRun

boolean shouldTestRun (AnnotatedElement annotatedElement)

Check if an element that has annotation passes the filter

Parameters
annotatedElement AnnotatedElement: the element to filter
Returns
boolean true if the test should run, false otherwise

shouldTestRun

boolean shouldTestRun (Description desc)

Check if the Description that contains annotations passes the filter

Parameters
desc Description: the element to filter
Returns
boolean true if the test should run, false otherwise