java.lang.Object | ||
↳ | org.junit.runner.Runner | |
↳ | org.junit.runners.ParentRunner<T> |
Known Direct Subclasses |
Known Indirect Subclasses |
Provides most of the functionality specific to a Runner that implements a
"parent node" in the test tree, with children defined by objects of some data
type T
. (For BlockJUnit4ClassRunner
, T
is
Method
. For Suite
, T
is Class
.) Subclasses
must implement finding the children of the node, describing each child, and
running each child. ParentRunner will filter and sort children, handle
@BeforeClass
and @AfterClass
methods, create a composite
Description
, and run children sequentially.
Protected Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Constructs a new
ParentRunner that will run @TestClass |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Remove tests that don't pass the parameter
filter . | |||||||||||
Returns a
TestClass object wrapping the class to be executed. | |||||||||||
Run the tests for this runner.
| |||||||||||
Sets a scheduler that determines the order and parallelization
of children.
| |||||||||||
Sorts the tests using
sorter |
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Returns a
Statement : Call runChild(Object, RunNotifier)
on each object returned by getChildren() (subject to any imposed
filter and sort)
| |||||||||||
Constructs a
Statement to run all of the tests in the test class. | |||||||||||
Adds to
errors a throwable for each problem noted with the test class (available from getTestClass() ). | |||||||||||
Returns a
Description for child , which can be assumed to
be an element of the list returned by getChildren()
| |||||||||||
Returns a list of objects that define the children of this Runner.
| |||||||||||
Returns a name used to describe this Runner
| |||||||||||
Runs the test corresponding to
child , which can be assumed to be
an element of the list returned by getChildren() . | |||||||||||
Adds to
errors if any method in this class is annotated with
annotation , but:
| |||||||||||
Returns a
Statement : run all non-overridden @AfterClass methods on this class
and superclasses before executing statement ; all AfterClass methods are
always executed: exceptions thrown by previous steps are combined, if
necessary, with exceptions from AfterClass methods into a
MultipleFailureException . | |||||||||||
Returns a
Statement : run all non-overridden @BeforeClass methods on this class
and superclasses before executing statement ; if any throws an
Exception, stop execution and pass the exception on. |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.junit.runner.Runner
| |||||||||||
From class
java.lang.Object
| |||||||||||
From interface
org.junit.runner.Describable
| |||||||||||
From interface
org.junit.runner.manipulation.Filterable
| |||||||||||
From interface
org.junit.runner.manipulation.Sortable
|
Constructs a new ParentRunner
that will run @TestClass
InitializationError |
---|
Remove tests that don't pass the parameter filter
.
filter | the Filter to apply |
---|
NoTestsRemainException |
---|
Returns a TestClass
object wrapping the class to be executed.
Run the tests for this runner.
notifier | will be notified of events while tests are being run--tests being started, finishing, and failing |
---|
Sets a scheduler that determines the order and parallelization of children. Highly experimental feature that may change.
Sorts the tests using sorter
sorter | the Sorter to use for sorting the tests
|
---|
Returns a Statement
: Call runChild(Object, RunNotifier)
on each object returned by getChildren()
(subject to any imposed
filter and sort)
Constructs a Statement
to run all of the tests in the test class. Override to add pre-/post-processing.
Here is an outline of the implementation:
runChild(Object, RunNotifier)
on each object returned by getChildren()
(subject to any imposed filter and sort).@BeforeClass
methods on this class
and superclasses before the previous step; if any throws an
Exception, stop execution and pass the exception on.
@AfterClass
methods on this class
and superclasses before any of the previous steps; all AfterClass methods are
always executed: exceptions thrown by previous steps are combined, if
necessary, with exceptions from AfterClass methods into a
MultipleFailureException
.
Statement
Adds to errors
a throwable for each problem noted with the test class (available from getTestClass()
).
Default implementation adds an error for each method annotated with
@BeforeClass
or @AfterClass
that is not
public static void
with no arguments.
Returns a Description
for child
, which can be assumed to
be an element of the list returned by getChildren()
Returns a list of objects that define the children of this Runner.
Runs the test corresponding to child
, which can be assumed to be
an element of the list returned by getChildren()
.
Subclasses are responsible for making sure that relevant test events are
reported through notifier
Adds to errors
if any method in this class is annotated with
annotation
, but:
isStatic is false
), or
isStatic is true
).
Returns a Statement
: run all non-overridden @AfterClass
methods on this class
and superclasses before executing statement
; all AfterClass methods are
always executed: exceptions thrown by previous steps are combined, if
necessary, with exceptions from AfterClass methods into a
MultipleFailureException
.
Returns a Statement
: run all non-overridden @BeforeClass
methods on this class
and superclasses before executing statement
; if any throws an
Exception, stop execution and pass the exception on.