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

Package | org.flexunit.runner.notification
Interface | public interface IRunNotifier
Implementors | RunNotifier

`IRunNotifier`s are a type of class that FlexUnit4 uses to notify others of an event that occurred during testing. There is generally only one `IRunNotifier` used in a test run at a time. `IRunNotifier`s are used by the `IRunner` classes to notify others of the following conditions:

- For the Test Run: Started/Finished
- For an Individual Test: Started/Failed/Ignored/Finished/AssumptionFailures

A parallel can be drawn with `IEventDispatcher`; however, unlike an event dispatcher, `IRunNotifier`s have limitations on what types of objects can listen to their events. An `IRunListeners`s are used to listen to events that are broadcast by `IRunNotifier`s. Each `IRunNotifier` contain an `#addListener()` and `#removeListener` method that accetps an `IRunListener` as an argument. If one writes an `IRunner`, they may need to notify FlexUnit4 of their progress while running tests. This is accomplished by invoking the `IRunNotifier` passed to the implementation of `org.flexunit.runner.IRunner#run(RunNotifier)`.

See also

org.flexunit.runner.notification.IRunListener

Public Methods

| Method | Defined By
--- | --- | ---
|  | addFirstListener(listener:IRunListener):void Adds IRunListener to the beginning of the list of registered listeners in the IRunNotifier. | IRunNotifier
|  | addListener(listener:IRunListener):void Adds an IRunListener to the list of registered listeners in the IRunNotifier. | IRunNotifier
|  | fireTestAssumptionFailed(failure:Failure):void Invoke to tell all registered IRunListeners that an atomic test flagged that it assumed something false. | IRunNotifier
|  | fireTestFailure(failure:Failure):void Invoke to tell all registered IRunListeners that an atomic test failed. | IRunNotifier
|  | fireTestFinished(description:IDescription):void Invoke to tell all registered IRunListeners that an atomic test finished. | IRunNotifier
|  | fireTestIgnored(description:IDescription):void Invoke to tell all registered IRunListeners that an atomic test was ignored. | IRunNotifier
|  | fireTestRunFinished(result:Result):void Invoke to tell all registered IRunListeners that the test run has finished. | IRunNotifier
|  | fireTestRunStarted(description:IDescription):void Invoke to tell all registered IRunListeners that the test run has started. | IRunNotifier
|  | fireTestStarted(description:IDescription):void Invoke to tell all registered IRunListeners that an atomic test has started. | IRunNotifier
|  | removeAllListeners():void Removes all IRunListener instances from the list of registered listeners in the IRunNotifier. | IRunNotifier
|  | removeListener(listener:IRunListener):void Removes an IRunListener from the list of registered listeners in the IRunNotifier. | IRunNotifier

Method Detail

addFirstListener | () | method

`public function addFirstListener(listener:IRunListener):void`

Adds `IRunListener` to the beginning of the list of registered listeners in the `IRunNotifier`.

Parameters

| `listener:IRunListener` — The `IRunListener` to add to the beginning.

addListener | () | method |

`public function addListener(listener:IRunListener):void`

Adds an `IRunListener` to the list of registered listeners in the `IRunNotifier`.

Parameters

| `listener:IRunListener` — The `IRunListener` to add.

fireTestAssumptionFailed | () | method |

`public function fireTestAssumptionFailed(failure:Failure):void`

Invoke to tell all registered `IRunListener`s that an atomic test flagged that it assumed something false.

Parameters

| `failure:Failure` — The `Failure` indicating what `AssumptionViolatedException` was thrown.

fireTestFailure | () | method |

`public function fireTestFailure(failure:Failure):void`

Invoke to tell all registered `IRunListener`s that an atomic test failed.

Parameters

| `failure:Failure` — The `Failure` indicating why the test ended up failing.

fireTestFinished | () | method |

`public function fireTestFinished(description:IDescription):void`

Invoke to tell all registered `IRunListener`s that an atomic test finished. Always invoke `#fireTestFinished(IDescription)` if you invoke `#fireTestStarted(IDescription)` as listeners are likely to expect them to come in pairs.

Parameters

| `description:IDescription` — The `IDescription` of the test that finished.

fireTestIgnored | () | method |

`public function fireTestIgnored(description:IDescription):void`

Invoke to tell all registered `IRunListener`s that an atomic test was ignored.

Parameters

| `description:IDescription` — The `IDescription` of the ignored test.

fireTestRunFinished | () | method |

`public function fireTestRunFinished(result:Result):void`

Invoke to tell all registered `IRunListener`s that the test run has finished.

Parameters

| `result:Result` — The `Result` of the test run.

fireTestRunStarted | () | method |

`public function fireTestRunStarted(description:IDescription):void`

Invoke to tell all registered `IRunListener`s that the test run has started.

Parameters

| `description:IDescription` — An `IDescription` of the top most `IRunner`.

fireTestStarted | () | method |

`public function fireTestStarted(description:IDescription):void`

Invoke to tell all registered `IRunListener`s that an atomic test has started.

Parameters

| `description:IDescription` — An `IDescription` of the atomic test (generally a class and method name).

removeAllListeners | () | method |

`public function removeAllListeners():void`

Removes all `IRunListener` instances from the list of registered listeners in the `IRunNotifier`.

removeListener | () | method |

`public function removeListener(listener:IRunListener):void`

Removes an `IRunListener` from the list of registered listeners in the `IRunNotifier`.

Parameters

| `listener:IRunListener` — The `IRunListener` to remove.

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