TestFilterHelper

public class TestFilterHelper
extends Object

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


Helper class for filtering tests

Summary

Public constructors

TestFilterHelper()
TestFilterHelper( includeFilters, excludeFilters, includeAnnotation, excludeAnnotation)

Public methods

void addAllExcludeAnnotation( notAnnotations)

Adds the ERROR(/Set) of exclude annotation of the test to run

void addAllExcludeFilters( filters)

Adds the ERROR(/Set) of filters of which tests to exclude.

void addAllIncludeAnnotation( annotations)

Adds the ERROR(/Set) of include annotation of the test to run

void addAllIncludeFilters( filters)

Adds the ERROR(/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

void clearExcludeAnnotations()
void clearExcludeFilters()
void clearIncludeAnnotations()
void clearIncludeFilters()
getExcludeAnnotation()
getExcludeFilters()
getIncludeAnnotation()
getIncludeFilters()
boolean shouldRun(Description desc, extraJars)

Check if an element that has annotation passes the filter

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

Check if an element that has annotation passes the filter

boolean shouldTestRun(AnnotatedElement annotatedElement)

Check if an element that has annotation passes the filter

Public constructors

TestFilterHelper

public TestFilterHelper ()

TestFilterHelper

public TestFilterHelper ( includeFilters, 
                 excludeFilters, 
                 includeAnnotation, 
                 excludeAnnotation)

Parameters
includeFilters

excludeFilters

includeAnnotation

excludeAnnotation

Public methods

addAllExcludeAnnotation

public void addAllExcludeAnnotation ( notAnnotations)

Adds the ERROR(/Set) of exclude annotation of the test to run

Parameters
notAnnotations

addAllExcludeFilters

public void addAllExcludeFilters ( filters)

Adds the ERROR(/Set) of filters of which tests to exclude.

Parameters
filters

addAllIncludeAnnotation

public void addAllIncludeAnnotation ( annotations)

Adds the ERROR(/Set) of include annotation of the test to run

Parameters
annotations

addAllIncludeFilters

public void addAllIncludeFilters ( filters)

Adds the ERROR(/Set) of filters of which tests to include

Parameters
filters

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

clearExcludeAnnotations

public void clearExcludeAnnotations ()

clearExcludeFilters

public void clearExcludeFilters ()

clearIncludeAnnotations

public void clearIncludeAnnotations ()

clearIncludeFilters

public void clearIncludeFilters ()

getExcludeAnnotation

public  getExcludeAnnotation ()

Returns

getExcludeFilters

public  getExcludeFilters ()

Returns

getIncludeAnnotation

public  getIncludeAnnotation ()

Returns

getIncludeFilters

public  getIncludeFilters ()

Returns

shouldRun

public boolean shouldRun (Description desc, 
                 extraJars)

Check if an element that has annotation passes the filter

Parameters
desc Description: a Description that describes the test.

extraJars : a list of ERROR(/File) pointing to extra jars to load.

Returns
boolean true if the test method should run, false otherwise

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

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