Class Suite

  • All Implemented Interfaces:
    Describable, Filterable, Orderable, Sortable
    Direct Known Subclasses:
    Categories, 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.
    Since:
    4.0
    • Constructor Detail

      • Suite

        public Suite​(java.lang.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,
                     java.lang.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
      • Suite

        protected Suite​(java.lang.Class<?> klass,
                        java.lang.Class<?>[] suiteClasses)
                 throws InitializationError
        Call this when the default builder is good enough. Left in for compatibility with JUnit 4.4.
        Parameters:
        klass - the root of the suite
        suiteClasses - the classes in the suite
        Throws:
        InitializationError
      • Suite

        protected Suite​(RunnerBuilder builder,
                        java.lang.Class<?> klass,
                        java.lang.Class<?>[] suiteClasses)
                 throws InitializationError
        Called by this class and subclasses once the classes making up the suite have been determined
        Parameters:
        builder - builds runners for classes in the suite
        klass - the root of the suite
        suiteClasses - the classes in the suite
        Throws:
        InitializationError
      • Suite

        protected Suite​(java.lang.Class<?> klass,
                        java.util.List<Runner> runners)
                 throws InitializationError
        Called by this class and subclasses once the runners making up the suite have been determined
        Parameters:
        klass - root of the suite
        runners - for each class in the suite, a Runner
        Throws:
        InitializationError