API Documentation | All Packages | All Classes | Index | Frames No Frames |
Suite

Package | org.flexunit.runners
Class | public class Suite
Inheritance | Suite ParentRunner Object
Implements | IFilterable, IExternalDependencyRunner

A `Suite` is an `IRunner` that contains test cases and other `Suites` to be run during the course of a test run. The `Suite` is responsible for locating all non-static classes that it contains and obtaining an array of `IRunner`s for each child that was found in this manner. The `IRunnerBuilder` to be used to determine the runner for the child classes is provided to the `Suite` during its instantiation. When a `Suite` goes to run a child, it is telling another `IRunner` to begin running, supplying the `IRunner` with an `IRunNotifier` in order to keep track of the test run. An `AsyncTestToken` is also provided to the child `IRunner` in order to notify the `Suite` when the child has finished. In order to declare a class as a suite class, the class must include a `[Suite]` and `[RunWith("org.flexunit.runners.Suite")]` metadata tag. The `[RunWith]` tag will instruct an `IRunnerBuilder` to use the `Suite` `IRunner` for the class.

    	 [Suite]
    	 [RunWith("org.flexunit.runners.Suite")]
    	 public class SuiteToRun
    	 {
    	 	public var oneTest:OneTest; //A Test
    	 	public var anotherTest:AnotherTest; //Another Test
    	 	public var differentSuite:DifferentSuite; //A Suite
    	 }

Public Properties

| Property | Defined By
--- | --- | ---
|  | dependencyWatcher : IExternalRunnerDependencyWatcher [write-only] Setter for a dependency watcher. | Suite
|  | description : IDescription [override] [read-only] | Suite
|  | externalDependencyError : String [write-only] Setter to indicate an error occured while attempting to load exteranl dependencies for this test. | Suite

Protected Properties
Hide Inherited Protected Properties
Show Inherited Protected Properties

| Property | Defined By
--- | --- | ---
|  | children : Array [override] [read-only] Returns a list of objects that define the children of this Runner. | Suite
|  | 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
Hide Inherited Public Methods
Show Inherited Public Methods

| Method | Defined By
--- | --- | ---
|  | Suite(arg1:*, arg2:*) This will either be passed a builder, followed by an array of classes... | Suite
|  | filter(filter:IFilter):void Applies the provided Filter to the runner. | ParentRunner
|  | pleaseStop():void [override] Ask that the tests run stop before starting the next test. | Suite
|  | 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
Show Inherited Protected Methods
Show Inherited Protected Methods

| Method | Defined By
--- | --- | ---
|  | 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). | ParentRunner
|  | classBlock(notifier:IRunNotifier):IAsyncStatement 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 [override] Returns an IDescription for child, which can be assumed to be an element of the list returned by ParentRunner#children(). | Suite
|  | generateDescription():IDescription Returns an IDescription of the test class that the runner is running. | ParentRunner
|  | runChild(child:*, notifier:IRunNotifier, childRunnerToken:AsyncTestToken):void [override] Runs the test corresponding to child, which can be assumed to be an element of the list returned by ParentRunner#children(). | Suite
|  | 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
|  | 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. | ParentRunner
|  | 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. | ParentRunner

Property Detail

children | property

`children:Array` [read-only] [override]

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

Implementation
`protected function get children():Array`

dependencyWatcher | property |

`dependencyWatcher:IExternalRunnerDependencyWatcher` [write-only]

Setter for a dependency watcher. This is a class that implements IExternalRunnerDependencyWatcher and watches for any external dependencies (such as loading data) are finalized before execution of tests is allowed to commence.

Implementation
`public function set dependencyWatcher(value:IExternalRunnerDependencyWatcher):void`

description | property |

`description:IDescription` [read-only] [override]

Implementation
`public function get description():IDescription`

externalDependencyError | property |

`externalDependencyError:String` [write-only]

Setter to indicate an error occured while attempting to load exteranl dependencies for this test. It accepts a string to allow the creator of the external dependency loader to pass a viable error string back to the user.

Implementation
`public function set externalDependencyError(value:String):void`
Constructor Detail

Suite | () | Constructor

`public function Suite(arg1:*, arg2:*)`

This will either be passed a builder, followed by an array of classes... (when there is not root class) Or it will be passed a root class and a builder. So, the two signatures we are supporting are: Suite( builder:IRunnerBuilder, classes:Array ) Suite( testClass:Class, builder:IRunnerBuilder )

Parameters

| `arg1:*`
| `arg2:*`

Method Detail

describeChild | () | method

`override 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`.

pleaseStop | () | method |

`override 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.

runChild | () | method |

`override 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.

Thu Apr 10 2014, 08:07 AM +10:00