org.junit.runners
Class Suite
java.lang.Object
org.junit.runner.Runner
org.junit.runners.ParentRunner<Runner>
org.junit.runners.Suite
- All Implemented Interfaces:
- Describable, Filterable, Sortable
- Direct Known Subclasses:
- Enclosed, Parameterized
public class Suite
- extends ParentRunner<Runner>
Using Suite
as a runner allows you to manually
build a suite containing tests from many classes. It is the JUnit 4 equivalent of the JUnit 3.8.x
static Test
suite()
method. To use it, annotate a class
with @RunWith(Suite.class)
and @SuiteClasses(TestClass1.class, ...)
.
When you run this class, it will run all the tests in all the suite classes.
Nested Class Summary |
static interface |
Suite.SuiteClasses
The SuiteClasses annotation specifies the classes to be run when a class
annotated with @RunWith(Suite.class) is run. |
Constructor Summary |
Suite(Class<?> klass,
RunnerBuilder builder)
Called reflectively on classes annotated with @RunWith(Suite.class) |
Suite(RunnerBuilder builder,
Class<?>[] classes)
Call this when there is no single root class (for example, multiple class names
passed on the command line to JUnitCore |
Suite
public Suite(Class<?> klass,
RunnerBuilder builder)
throws InitializationError
- Called reflectively on classes annotated with
@RunWith(Suite.class)
- Parameters:
klass
- the root classbuilder
- builds runners for classes in the suite
- Throws:
InitializationError
Suite
public Suite(RunnerBuilder builder,
Class<?>[] classes)
throws InitializationError
- Call this when there is no single root class (for example, multiple class names
passed on the command line to
JUnitCore
- Parameters:
builder
- builds runners for classes in the suiteclasses
- the classes in the suite
- Throws:
InitializationError
emptySuite
public static Runner emptySuite()
- Returns an empty suite.