Packageorg.flexunit.runners
Classpublic class ParentRunner
InheritanceParentRunner Inheritance Object
Implements IRunner, ISortable
Subclasses BlockFlexUnit4ClassRunner, Parameterized, Suite

The 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

org.flexunit.runners.BlockFlexUnit4ClassRunner
org.flexunit.runners.Suite


Public Properties
 PropertyDefined By
  description : IDescription
[read-only] Returns an IDescription of the test class that the runner is running, caching it.
ParentRunner
Protected Properties
 PropertyDefined 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
Public Methods
 MethodDefined By
  
ParentRunner(klass:Class)
Constructs a new ParentRunner that will run TestClass.
ParentRunner
  
filter(filter:IFilter):void
Applies the provided Filter to the runner.
ParentRunner
  
pleaseStop():void
Ask that the tests run stop before starting the next test.
ParentRunner
  
run(notifier:IRunNotifier, previousToken:IAsyncTestToken):void
Runs the test class and updates the notifier on the status of running the tests.
ParentRunner
  
sort(sorter:ISorter):void
Applies the provided ISorter to the runner.
ParentRunner
Protected Methods
 MethodDefined 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
  
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
  
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().
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
Property Detail
childrenproperty
children:Array  [read-only]

Returns a list of objects that define the children of this Runner.


Implementation
    protected function get children():Array
descriptionproperty 
description:IDescription  [read-only]

Returns an IDescription of the test class that the runner is running, caching it.


Implementation
    public function get description():IDescription
nameproperty 
name:String  [read-only]

Returns a name used to describe this Runner.


Implementation
    protected function get name():String
stopRequestedproperty 
protected var stopRequested:Boolean = false

private

testClassproperty 
testClass:TestClass  [read-only]

Returns a TestClass object wrapping the class to be executed.


Implementation
    protected function get testClass():TestClass
Constructor Detail
ParentRunner()Constructor
public function ParentRunner(klass:Class)

Constructs a new ParentRunner that will run TestClass.

Parameters
klass:Class — The test class that is to be executed by the runner.

Throws
org.flexunit.internals.runners:InitializationError
Method Detail
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.

Returns
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:

Parameters

notifier:IRunNotifier — The IRunNotifier to notify on the progress of the children.

Returns
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

Returns
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.

Returns
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.


Throws
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.

Returns
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.


Throws
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:

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.

Returns
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.

Returns
IAsyncStatement — an IAsyncStatement containing methdos to run before the class.