AndroidJUnitTest
java.lang.Object
↳
com.android.tradefed.testtype.AndroidJUnitTest
A Test that runs an instrumentation test package on given device using the
android.support.test.runner.AndroidJUnitRunner.
Summary
Fields
public
static
final
String
public
static
final
String
Options from the collector side helper library.
public
static
final
String
instrumentation test runner argument used to enable the new
Public constructors
Public methods
void
Adds a
void
Adds the
void
Adds a
void
Adds the
void
addExcludeAnnotation(String excludeAnnotation)
Adds an annotation to exclude if a tests if marked with it.
void
Adds a filter of which tests to exclude.
void
Adds an annotation to include if a tests if marked with it.
void
Adds a filter of which tests to include.
void
Delete all the exclude annotations currently tracked.
void
Delete all the exclude filters currently tracked.
void
Delete all the include annotations currently tracked.
void
Delete all the include filters currently tracked.
Returns the current
Returns the current
Returns the current
Returns the current
long
Return the expected runtime of the test in
milliseconds.
boolean
isClassOrMethod(String filter)
Return if a string is the name of a Class or a Method.
boolean
isRegex(String filter)
Return if a string is a regex for filter.
void
Runs the tests, and reports result to the listener.
void
Guice-injected object, that can influence the instrumentation args.
void
Sets the test file of excludes.
void
Sets the test file of includes.
split(int shardCount)
Alternative version of
Protected methods
void
setRunnerArgs(IRemoteAndroidTestRunner runner)
Fields
EXCLUDE_COLLECTOR_FILTER_KEY
public static final String EXCLUDE_COLLECTOR_FILTER_KEY
INCLUDE_COLLECTOR_FILTER_KEY
public static final String INCLUDE_COLLECTOR_FILTER_KEY
Options from the collector side helper library.
NEW_RUN_LISTENER_ORDER_KEY
public static final String NEW_RUN_LISTENER_ORDER_KEY
instrumentation test runner argument used to enable the new
Public constructors
AndroidJUnitTest
public AndroidJUnitTest ()
Public methods
addAllExcludeAnnotation
public void addAllExcludeAnnotation (excludeAnnotations)
Adds a
Parameters
excludeAnnotations
addAllExcludeFilters
public void addAllExcludeFilters (filters)
Adds the
Parameters
filters
addAllIncludeAnnotation
public void addAllIncludeAnnotation (annotations)
Adds a
Parameters
annotations
addAllIncludeFilters
public void addAllIncludeFilters (filters)
Adds the
Parameters
filters
addExcludeAnnotation
public void addExcludeAnnotation (String excludeAnnotation)
Adds an annotation to exclude if a tests if marked with it.
Parameters
excludeAnnotation
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 annotation to include if a tests if marked with it.
Parameters
annotation
String
addIncludeFilter
public void addIncludeFilter (String filter)
Adds a filter of which tests to include.
Parameters
filter
String
clearExcludeAnnotations
public void clearExcludeAnnotations ()
Delete all the exclude annotations currently tracked.
clearExcludeFilters
public void clearExcludeFilters ()
Delete all the exclude filters currently tracked.
clearIncludeAnnotations
public void clearIncludeAnnotations ()
Delete all the include annotations currently tracked.
clearIncludeFilters
public void clearIncludeFilters ()
Delete all the include filters currently tracked.
getExcludeAnnotations
public getExcludeAnnotations ()
Returns the current
Returns
getExcludeFilters
public getExcludeFilters ()
Returns the current
Returns
getIncludeAnnotations
public getIncludeAnnotations ()
Returns the current
Returns
getIncludeFilters
public getIncludeFilters ()
Returns the current
Returns
getRuntimeHint
public long getRuntimeHint ()
Return the expected runtime of the test in
milliseconds.
The time is used to load balance sharded execution
Returns
long
isClassOrMethod
public boolean isClassOrMethod (String filter)
Return if a string is the name of a Class or a Method.
Parameters
filter
String
Returns
boolean
isRegex
public boolean isRegex (String filter)
Return if a string is a regex for filter.
Parameters
filter
String
Returns
boolean
run
public void run (ITestInvocationListener listener)
Runs the tests, and reports result to the listener.
Parameters
listener
ITestInvocationListener: the
setDeviceSpec
public void setDeviceSpec (IConfiguration spec)
Guice-injected object, that can influence the instrumentation args.
Parameters
spec
IConfiguration
setExcludeTestFile
public void setExcludeTestFile (File testFile)
Sets the test file of excludes. Does not ensure that testFile exists or is a file.
Parameters
testFile
File
setIncludeTestFile
public void setIncludeTestFile (File testFile)
Sets the test file of includes. Does not ensure that testFile exists or is a file.
Parameters
testFile
File
split
public split (int shardCount)
Alternative version of
Parameters
shardCount
int: the attempted shard count.
Returns
a collection of subtests to be executed separately or null if test is
not currently shardable
Protected methods
setRunnerArgs
protected void setRunnerArgs (IRemoteAndroidTestRunner runner)
Parameters
runner
IRemoteAndroidTestRunner