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

Package | org.flexunit.runner.notification
Class | public class RunListener
Inheritance | RunListener Object
Implements | IRunListener
Subclasses | TextListener, TraceListener

If you need to respond to the events during a test run, extend `RunListener` and override the appropriate methods. If a listener throws an exception while processing a test event, it will be removed for the remainder of the test run.

For example, suppose you have a `Cowbell` class that you want to make a noise whenever a test fails. You could write:

    	 public class RingingListener extends RunListener {
    	 	public function testFailure(failure:Failure):void {
    	 		Cowbell.ring();
    	 	}
    	 }

To invoke your listener, you need to run your tests through `FlexUnitCore`.

    	 core:FlexUnitCore = new FlexUnitCore();
    	 core.addListener(new RingingListener());
    	 core.run(MyTestClass);

See also

org.flexunit.runner.FlexUnitCore

Public Properties

| Property | Defined By
--- | --- | ---
|  | result : Result The Result recieved for a finished test run. | RunListener

Public Methods

| Method | Defined By
--- | --- | ---
|  | testAssumptionFailure(failure:Failure):void Called when an atomic test flags that it assumes a condition that is false | RunListener
|  | testFailure(failure:Failure):void Called when an atomic test fails. | RunListener
|  | testFinished(description:IDescription):void Called when an atomic test has finished, whether the test succeeds or fails. | RunListener
|  | testIgnored(description:IDescription):void Called when a test will not be run, generally because a test method is annotated with org.junit.Ignore. | RunListener
|  | testRunFinished(result:Result):void Called when all tests have finished | RunListener
|  | testRunStarted(description:IDescription):void Called before any tests have been run. | RunListener
|  | testStarted(description:IDescription):void Called when an atomic test is about to be started. | RunListener

Property Detail

result | property

`public var result:Result`

The `Result` recieved for a finished test run.

Method Detail

testAssumptionFailure | () | method

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

Called when an atomic test flags that it assumes a condition that is false

Parameters

| `failure:Failure` — describes the test that failed and the `AssumptionViolatedException` that was thrown

testFailure | () | method |

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

Called when an atomic test fails.

Parameters

| `failure:Failure` — describes the test that failed and the exception that was thrown

testFinished | () | method |

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

Called when an atomic test has finished, whether the test succeeds or fails.

Parameters

| `description:IDescription` — the description of the test that just ran

testIgnored | () | method |

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

Called when a test will not be run, generally because a test method is annotated with `org.junit.Ignore`.

Parameters

| `description:IDescription` — describes the test that will not be run

testRunFinished | () | method |

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

Called when all tests have finished

Parameters

| `result:Result` — the summary of the test run, including all the tests that failed

testRunStarted | () | method |

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

Called before any tests have been run.

Parameters

| `description:IDescription` — describes the tests to be run

testStarted | () | method |

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

Called when an atomic test is about to be started.

Parameters

| `description:IDescription` — the description of the test that is about to be run (generally a class and method name)

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