public class TestSuiteBuilder extends Object
Modifier and Type | Class and Description |
---|---|
static class |
TestSuiteBuilder.FailedToCreateTests
A special
junit.framework.TestCase used to indicate a failure during the build()
step. |
Constructor and Description |
---|
TestSuiteBuilder(Class clazz)
The given name is automatically prefixed with the package containing the tests to be run.
|
TestSuiteBuilder(String name,
ClassLoader classLoader) |
Modifier and Type | Method and Description |
---|---|
TestSuiteBuilder |
addRequirements(List<Predicate<TestMethod>> predicates)
Exclude tests that fail to satisfy all of the given predicates.
|
TestSuiteBuilder |
addRequirements(Predicate<TestMethod>... predicates)
Exclude tests that fail to satisfy all of the given predicates.
|
TestSuiteBuilder |
addTestClassByName(String testClassName,
String testMethodName,
Context context) |
TestSuiteBuilder |
addTestSuite(TestSuite testSuite) |
TestSuite |
build()
Call this method once you've configured your builder as desired.
|
TestSuiteBuilder |
excludePackages(String... packageNames)
Exclude all tests in the given packages and all sub-packages, unless otherwise specified.
|
protected String |
getSuiteName()
Subclasses use this method to determine the name of the suite.
|
protected TestGrouping |
getTestGrouping() |
TestSuiteBuilder |
includeAllPackagesUnderHere()
Include all junit tests that satisfy the requirements in the calling class' package and all
sub-packages.
|
TestSuiteBuilder |
includePackages(String... packageNames)
Include all tests that satisfy the requirements in the given packages and all sub-packages,
unless otherwise specified.
|
TestSuiteBuilder |
named(String newSuiteName)
Override the default name for the suite being built.
|
public TestSuiteBuilder(Class clazz)
clazz
- Use the class from your .apk. Use the class name for the test suite name.
Use the class' classloader in order to load classes for testing.
This is needed when running in the emulator.public TestSuiteBuilder(String name, ClassLoader classLoader)
public TestSuiteBuilder addTestClassByName(String testClassName, String testMethodName, Context context)
public TestSuiteBuilder addTestSuite(TestSuite testSuite)
public TestSuiteBuilder includePackages(String... packageNames)
packageNames
- Names of packages to add.public TestSuiteBuilder excludePackages(String... packageNames)
packageNames
- Names of packages to remove.public TestSuiteBuilder addRequirements(List<Predicate<TestMethod>> predicates)
predicates
- Predicates to add to the list of requirements.public final TestSuiteBuilder includeAllPackagesUnderHere()
public TestSuiteBuilder named(String newSuiteName)
addRequirements(com.android.internal.util.Predicate[])
to make it clear which
tests will be included. The name you specify is automatically prefixed with the package
containing the tests to be run. If more than one package is specified, the first is used.newSuiteName
- Prefix of name to give the suite being built.public final TestSuite build()
protected String getSuiteName()
public final TestSuiteBuilder addRequirements(Predicate<TestMethod>... predicates)
named(String)
to override the default suite name.predicates
- Predicates to add to the list of requirements.protected TestGrouping getTestGrouping()