Package | org.flexunit.runners |
Class | public class ParentRunner |
Inheritance | ParentRunner ![]() |
Implements | IRunner, ISortable |
Subclasses | BlockFlexUnit4ClassRunner, Parameterized, Suite |
ParentRunner
provides most of the functionality specific to an
IRunner
that implements a "parent node" in the test tree. It is n
directly used as an IRunner
; instead, it is inherited by subclesses
that then implement additional functionality.
Subclasses must implement finding the children of the node, describing each child, and
running each child. The ParentRunner
will filter and sort children, handle
BeforeClass
and AfterClass
methods, create a composite
IDescription
, and run children sequentially.
See also
Property | Defined By | ||
---|---|---|---|
description : IDescription [read-only]
Returns an IDescription of the test class that the runner is running, caching it. | ParentRunner |
Property | Defined By | ||
---|---|---|---|
children : Array [read-only]
Returns a list of objects that define the children of this Runner. | ParentRunner | ||
name : String [read-only]
Returns a name used to describe this Runner. | ParentRunner | ||
stopRequested : Boolean = false
private
| ParentRunner | ||
testClass : TestClass [read-only]
Returns a TestClass object wrapping the class to be executed. | ParentRunner |
Method | Defined By | ||
---|---|---|---|
ParentRunner(klass:Class)
Constructs a new ParentRunner that will run TestClass. | ParentRunner | ||
Applies the provided Filter to the runner. | ParentRunner | ||
pleaseStop():void
Ask that the tests run stop before starting the next test. | ParentRunner | ||
Runs the test class and updates the notifier on the status of running the tests. | ParentRunner | ||
Applies the provided ISorter to the runner. | ParentRunner |
Method | Defined By | ||
---|---|---|---|
Returns an IAsyncStatement: Call #runChild(Object, IRunNotifier, AsyncTestToken)
on each object returned by #children() (subject to any imposed
filter and sort). | ParentRunner | ||
Constructs an IAsyncStatement to run all of the tests in the test class. | ParentRunner | ||
collectInitializationErrors(errors:Array):void
Adds to errors an error for each problem noted with the test class
(available from #testClass()). | ParentRunner | ||
compare(o1:Object, o2:Object):int
This sorting method uses the runner's ISorter to compare two child arguments. | ParentRunner | ||
describeChild(child:*):IDescription
Returns an IDescription for child, which can be assumed to
be an element of the list returned by ParentRunner#children(). | ParentRunner | ||
Returns an IDescription of the test class that the runner is running. | ParentRunner | ||
Runs the test corresponding to child, which can be assumed to be
an element of the list returned by ParentRunner#children(). | ParentRunner | ||
validatePublicVoidNoArgMethods(metaDataTag:String, isStatic:Boolean, errors:Array):void
Adds to errors if any method in this class is annotated with
metaDataTag, but:
is not public, or
takes parameters, or
returns something other than void, or
is static (given isStatic is false), or
is not static (given isStatic is true).
| ParentRunner | ||
Returns an IAsyncStatement: run all non-overridden AfterClass methods on this class
and superclasses before executing the statement; all AfterClass methods are
always executed: exceptions thrown by previous steps are combined, if
necessary, with exceptions from AfterClass methods into a
MultipleFailureException. | ParentRunner | ||
Returns an IAsyncStatement: run all non-overridden BeforeClass methods on this class
and superclasses before executing the statement; if any throws an
Exception, stop execution and pass the exception on. | ParentRunner |
children | property |
children:Array
[read-only] Returns a list of objects that define the children of this Runner.
protected function get children():Array
description | property |
description:IDescription
[read-only]
Returns an IDescription
of the test class that the runner is running, caching it.
public function get description():IDescription
name | property |
name:String
[read-only] Returns a name used to describe this Runner.
protected function get name():String
stopRequested | property |
protected var stopRequested:Boolean = false
private
testClass | property |
testClass:TestClass
[read-only]
Returns a TestClass
object wrapping the class to be executed.
protected function get testClass():TestClass
ParentRunner | () | Constructor |
public function ParentRunner(klass:Class)
Constructs a new ParentRunner
that will run TestClass
.
klass:Class — The test class that is to be executed by the runner.
|
org.flexunit.internals.runners:InitializationError
|
childrenInvoker | () | method |
protected function childrenInvoker(notifier:IRunNotifier):IAsyncStatement
Returns an IAsyncStatement
: Call #runChild(Object, IRunNotifier, AsyncTestToken)
on each object returned by #children()
(subject to any imposed
filter and sort).
Parameters
notifier:IRunNotifier — The IRunNotifier to notify on the progress of the children.
|
IAsyncStatement |
See also
classBlock | () | method |
protected function classBlock(notifier:IRunNotifier):IAsyncStatement
Constructs an IAsyncStatement
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, IRunNotifier, AsyncTestToken)
on each object returned by #children()
(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
.Parameters
notifier:IRunNotifier — The IRunNotifier to notify on the progress of the children.
|
IAsyncStatement — an IAsyncStatement .
|
See also
collectInitializationErrors | () | method |
protected function collectInitializationErrors(errors:Array):void
Adds to errors
an error for each problem noted with the test class
(available from #testClass()
).
Default implementation adds an error for each method annotated with
BeforeClass
or AfterClass
that is not
public static void
with no arguments.
Parameters
errors:Array — An Array of issues encountered when attempting to setup
the runner for the test class.
|
See also
compare | () | method |
protected function compare(o1:Object, o2:Object):int
This sorting method uses the runner's ISorter
to compare two child arguments.
Parameters
o1:Object | |
o2:Object |
int |
describeChild | () | method |
protected function describeChild(child:*):IDescription
Returns an IDescription
for child
, which can be assumed to
be an element of the list returned by ParentRunner#children()
.
Parameters
child:* — The child to describe.
|
IDescription — an IDescription of the provided child .
|
filter | () | method |
public function filter(filter:IFilter):void
Applies the provided Filter
to the runner. If every child of the test class is filtered out,
no children will be run, and a NoTestsRemainException
will be thrown.
Parameters
filter:IFilter — The Filter to apply to the runner.
|
NoTestsRemainException — Thrown if all children have been filtered.
|
generateDescription | () | method |
protected function generateDescription():IDescription
Returns an IDescription
of the test class that the runner is running.
IDescription |
pleaseStop | () | method |
public function pleaseStop():void
Ask that the tests run stop before starting the next test. Phrased politely because the test currently running will not be interrupted.
run | () | method |
public function run(notifier:IRunNotifier, previousToken:IAsyncTestToken):void
Runs the test class and updates the notifier
on the status of running the tests.
Parameters
notifier:IRunNotifier — The notifier that is notified about issues encountered during the execution of the test class.
| |
previousToken:IAsyncTestToken — The token that is to be notified when the runner has finished execution of the test class.
|
StoppedByUserException — The user has stopped the test run.
|
runChild | () | method |
protected function runChild(child:*, notifier:IRunNotifier, childRunnerToken:AsyncTestToken):void
Runs the test corresponding to child
, which can be assumed to be
an element of the list returned by ParentRunner#children()
.
Subclasses are responsible for making sure that relevant test events are
reported through notifier
.
Parameters
child:* — The child to run.
| |
notifier:IRunNotifier — The IRunNotifier to notify on the progress of the child .
| |
childRunnerToken:AsyncTestToken — The token used to keep track of the child 's execution.
|
sort | () | method |
public function sort(sorter:ISorter):void
Applies the provided ISorter
to the runner.
Parameters
sorter:ISorter — The ISorter to apply to the runner.
|
validatePublicVoidNoArgMethods | () | method |
protected function validatePublicVoidNoArgMethods(metaDataTag:String, isStatic:Boolean, errors:Array):void
Adds to errors
if any method in this class is annotated with
metaDataTag
, but:
isStatic
is false
), orisStatic
is true
).Parameters
metaDataTag:String — The metadata tag used to retrieve the methods.
| |
isStatic:Boolean — a Boolean value indicating whether the methods should be static.
| |
errors:Array — An Array of issues encountered when attempting to setup
the runner for the test class.
|
withAfterClasses | () | method |
protected function withAfterClasses():IAsyncStatement
Returns an IAsyncStatement
: run all non-overridden AfterClass
methods on this class
and superclasses before executing the statement
; all AfterClass
methods are
always executed: exceptions thrown by previous steps are combined, if
necessary, with exceptions from AfterClass
methods into a
MultipleFailureException
.
IAsyncStatement — an IAsyncStatement containing methods to run after the class.
|
withBeforeClasses | () | method |
protected function withBeforeClasses():IAsyncStatement
Returns an IAsyncStatement
: run all non-overridden BeforeClass
methods on this class
and superclasses before executing the statement
; if any throws an
Exception, stop execution and pass the exception on.
IAsyncStatement — an IAsyncStatement containing methdos to run before the class.
|