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

public TestFilterHelper ()

TestFilterHelper

public 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

public void addAllExcludeAnnotation (Set<String> notAnnotations)

Adds the Set of exclude annotation of the test to run

Parameters
notAnnotations Set

addAllExcludeFilters

public void addAllExcludeFilters (Set<String> filters)

Adds the Set of filters of which tests to exclude.

Parameters
filters Set

addAllIncludeAnnotation

public void addAllIncludeAnnotation (Set<String> annotations)

Adds the Set of include annotation of the test to run

Parameters
annotations Set

addAllIncludeFilters

public void addAllIncludeFilters (Set<String> filters)

Adds the Set of filters of which tests to include

Parameters
filters Set

addExcludeAnnotation

public void addExcludeAnnotation (String notAnnotation)

Adds an exclude annotation of the test to run

Parameters
notAnnotation String

addExcludeFilter

public void addExcludeFilter (String filter)

Adds a filter of which tests to exclude

Parameters
filter String

addIncludeAnnotation

public void addIncludeAnnotation (String annotation)

Adds an include annotation of the test to run

Parameters
annotation String

addIncludeFilter

public void addIncludeFilter (String filter)

Adds a filter of which tests to include

Parameters
filter String

getExcludeAnnotation

public Set<String> getExcludeAnnotation ()

Returns
Set<String>

getExcludeFilters

public Set<String> getExcludeFilters ()

Returns
Set<String>

getIncludeAnnotation

public Set<String> getIncludeAnnotation ()

Returns
Set<String>

getIncludeFilters

public Set<String> getIncludeFilters ()

Returns
Set<String>

shouldRun

public 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

public 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

public 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

public 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