org.junit.runners
Class Suite

java.lang.Object
  extended by org.junit.runner.Runner
      extended by org.junit.runners.ParentRunner<Runner>
          extended by 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
 
Method Summary
static Runner emptySuite()
          Returns an empty suite.
 
Methods inherited from class org.junit.runners.ParentRunner
filter, getDescription, getTestClass, run, setScheduler, sort
 
Methods inherited from class org.junit.runner.Runner
testCount
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Suite

public Suite(Class<?> klass,
             RunnerBuilder builder)
      throws InitializationError
Called reflectively on classes annotated with @RunWith(Suite.class)

Parameters:
klass - the root class
builder - 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 suite
classes - the classes in the suite
Throws:
InitializationError
Method Detail

emptySuite

public static Runner emptySuite()
Returns an empty suite.