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

Package | org.flexunit.runners.model
Interface | public interface IRunnerBuilder
Implementors | RunnerBuilderBase

An `IRunnerBuilder` is a strategy for constructing `IRunner`s for classes. Only writers of custom runners should use `IRunnerBuilder`s. A custom runner class with a constructor taking an `IRunnerBuilder` parameter will be passed the instance of `IRunnerBuilder` used to build that runner itself. For example, imagine a custom `IRunner` that builds suites based on a list of classes in a text file:

    	 RunWith(TextFileSuite.as)
    	 SuiteSpecFile("mysuite.txt")
    	 class MySuite {}

The implementation of TextFileSuite might include:

    	 public function TextFileSuite(testClass:Class, builder:IRunnerBuilder) {
    	   // ...
    	     var runner:IRunner = builder.runnerForClass( testClass );
    	   // ...
    	 }

See also

org.flexunit.runners.Suite

Public Methods

| Method | Defined By
--- | --- | ---
|  | canHandleClass(testClass:Class):Boolean Returns a boolean value indicating if this builder will be able to handle the testClass or not | IRunnerBuilder
|  | runnerForClass(testClass:Class):IRunner Returns an IRunner for a specific testClass. | IRunnerBuilder
|  | runners(parent:Class, children:Array):Array Constructs and returns a list of IRunners, one for each child class in children. | IRunnerBuilder
|  | safeRunnerForClass(testClass:Class):IRunner Returns an IRunner that can safely run the provided testClass. | IRunnerBuilder

Method Detail

canHandleClass | () | method

`public function canHandleClass(testClass:Class):Boolean`

Returns a boolean value indicating if this builder will be able to handle the testClass or not

Parameters

| `testClass:Class` — The class to test to determine an `IRunner`.

Returns

| `Boolean`

runnerForClass | () | method |

`public function runnerForClass(testClass:Class):IRunner`

Returns an `IRunner` for a specific `testClass`.

Parameters

| `testClass:Class` — The test class for which to determine an `IRunner`.

Returns

| `IRunner` — an `IRunner` that will run the `testClass`.

runners | () | method |

`public function runners(parent:Class, children:Array):Array`

Constructs and returns a list of `IRunner`s, one for each child class in `children`. Care is taken to avoid infinite recursion: this builder will throw an exception if it is requested for another runner for `parent` before this call completes.

Parameters

| `parent:Class` — The parent class that contains the `children`.
| `children:Array` — The child classes for which to find `IRunner`.

Returns

| `Array` — a list of `IRunner`s, one for each child class.

safeRunnerForClass | () | method |

`public function safeRunnerForClass(testClass:Class):IRunner`

Returns an `IRunner` that can safely run the provided `testClass`.

Parameters

| `testClass:Class` — The class to for which to determine an `IRunner`.

Returns

| `IRunner` — an `IRunner` that can run the `testClass`.

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