类 Suite
- java.lang.Object
- org.junit.runner.Runner
- org.junit.runners.ParentRunner<Runner>
- org.junit.runners.Suite
- 所有已实现的接口:
Describable
,Filterable
,Sortable
- 直接已知子类:
Categories
,Enclosed
,Parameterized
public class Suite extends ParentRunner<Runner>
UsingSuite
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 staticTest
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.- 从以下版本开始:
- 4.0
嵌套类概要
嵌套类 修饰符和类型 类 说明 static interface
Suite.SuiteClasses
TheSuiteClasses
annotation specifies the classes to be run when a class annotated with@RunWith(Suite.class)
is run.
构造器概要
构造器 限定符 构造器 说明 protected
Suite(Class<?> klass, Class<?>[] suiteClasses)
Call this when the default builder is good enough.protected
Suite(Class<?> klass, List<Runner> runners)
Called by this class and subclasses once the runners making up the suite have been determinedSuite(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 toJUnitCore
protected
Suite(RunnerBuilder builder, Class<?> klass, Class<?>[] suiteClasses)
Called by this class and subclasses once the classes making up the suite have been determined
方法概要
所有方法 静态方法 实例方法 具体方法 修饰符和类型 方法 说明 protected Description
describeChild(Runner child)
Returns aDescription
forchild
, which can be assumed to be an element of the list returned byParentRunner.getChildren()
static Runner
emptySuite()
Returns an empty suite.protected List<Runner>
getChildren()
Returns a list of objects that define the children of this Runner.protected void
runChild(Runner runner, RunNotifier notifier)
Runs the test corresponding tochild
, which can be assumed to be an element of the list returned byParentRunner.getChildren()
.从类继承的方法 org.junit.runners.ParentRunner
childrenInvoker, classBlock, classRules, collectInitializationErrors, createTestClass, filter, getDescription, getName, getRunnerAnnotations, getTestClass, isIgnored, run, runLeaf, setScheduler, sort, validatePublicVoidNoArgMethods, withAfterClasses, withBeforeClasses
构造器详细资料
Suite
public Suite(Class<?> klass, RunnerBuilder builder) throws InitializationError
Called reflectively on classes annotated with@RunWith(Suite.class)
- 参数:
klass
- the root classbuilder
- builds runners for classes in the suite- 抛出:
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 toJUnitCore
- 参数:
builder
- builds runners for classes in the suiteclasses
- the classes in the suite- 抛出:
InitializationError
Suite
protected Suite(Class<?> klass, Class<?>[] suiteClasses) throws InitializationError
Call this when the default builder is good enough. Left in for compatibility with JUnit 4.4.- 参数:
klass
- the root of the suitesuiteClasses
- the classes in the suite- 抛出:
InitializationError
Suite
protected Suite(RunnerBuilder builder, Class<?> klass, Class<?>[] suiteClasses) throws InitializationError
Called by this class and subclasses once the classes making up the suite have been determined- 参数:
builder
- builds runners for classes in the suiteklass
- the root of the suitesuiteClasses
- the classes in the suite- 抛出:
InitializationError
Suite
protected Suite(Class<?> klass, List<Runner> runners) throws InitializationError
Called by this class and subclasses once the runners making up the suite have been determined- 参数:
klass
- root of the suiterunners
- for each class in the suite, aRunner
- 抛出:
InitializationError
方法详细资料
emptySuite
public static Runner emptySuite()
Returns an empty suite.
getChildren
protected List<Runner> getChildren()
从类复制的说明:ParentRunner
Returns a list of objects that define the children of this Runner.- 指定者:
getChildren
在类中ParentRunner<Runner>
describeChild
protected Description describeChild(Runner child)
从类复制的说明:ParentRunner
Returns aDescription
forchild
, which can be assumed to be an element of the list returned byParentRunner.getChildren()
- 指定者:
describeChild
在类中ParentRunner<Runner>
runChild
protected void runChild(Runner runner, RunNotifier notifier)
从类复制的说明:ParentRunner
Runs the test corresponding tochild
, which can be assumed to be an element of the list returned byParentRunner.getChildren()
. Subclasses are responsible for making sure that relevant test events are reported throughnotifier
- 指定者:
runChild
在类中ParentRunner<Runner>