| Package | org.flexunit.runner |
| Class | public class FlexUnitCore |
| Inheritance | FlexUnitCore flash.events.EventDispatcher |
FlexUnitCore is responsible for executing objects that implement an IRequest
interface. There are several ways that the IRequest can be provided to the
FlexUnitCore. If you pass FlexUnit4’s core anything other than an IRequest, the
core uses these methods to generate a Request object before processing continues.
Ways that an IRequest can be provided to the FlexUnitCore are as follows:
#run method which will
eventaully create an IRequest.#runClasses() method to generate an IRequest.IRequest can be passed directly to the #runRequest() method.
IRequests can be generated by calling static methods that create IRequests
in the Request class.Request before execution begins. Once the
IRequest has been provided to the FlexUnitCore, the test run will begin
once all IRunListener are ready.
In order to add an IRunListener to the test run, the #addListener() method must
called. If one wishes to remove a listener from the test run, the #removeListener() method
needs to be called with IRunListener to remove.
Once the test run has finished execution, a Result will be obtained and the IRunListeners
will be notified of the results of the test run.
See also
| Property | Defined By | ||
|---|---|---|---|
| version : String [static] [read-only]
Returns the version number. | FlexUnitCore | ||
| visualDisplayRoot : DisplayObjectContainer
Allows you to get or set the appropriate visualDisplayRoot for this test run. | FlexUnitCore | ||
| Method | Defined By | ||
|---|---|---|---|
Create a new FlexUnitCore to run tests. | FlexUnitCore | ||
addListener(listener:IRunListener):void
Add a listener to be notified as the tests run. | FlexUnitCore | ||
addUncaughtErrorListener(loaderInfo:LoaderInfo, priority:int = 1):void
Adds a generic listener for errors. | FlexUnitCore | ||
pleaseStop():void
Requests that the FlexUnitCore stop execution of the test environment. | FlexUnitCore | ||
removeListener(listener:IRunListener):void
Remove a listener. | FlexUnitCore | ||
run(... args):void
Determines what classes can be found in the provided args. | FlexUnitCore | ||
runClasses(... args):void
Wraps the class arguments contained in args into a Request. | FlexUnitCore | ||
runRequest(request:Request):void
Runs the classes contained in the Request using the IRunner of
the Request. | FlexUnitCore | ||
Runs the tests contained in IRunner if all IAsyncStartupRunListerners
are ready; otherwise, the the test run will begin once all listeners have reported that they
are ready.
Once the test run begins, feedback will be written while the tests are running and stack traces
writes will be made for all failed tests after all tests complete. | FlexUnitCore | ||
| Method | Defined By | ||
|---|---|---|---|
beginRunnerExecution(runner:IRunner):void
Starts the execution of the IRunner. | FlexUnitCore | ||
| Constant | Defined By | ||
|---|---|---|---|
| RUNNER_COMPLETE : String = runnerComplete [static] | FlexUnitCore | ||
| RUNNER_START : String = runnerStart [static] | FlexUnitCore | ||
| TESTS_COMPLETE : String = testsComplete [static] | FlexUnitCore | ||
| TESTS_STOPPED : String = testsStopped [static] | FlexUnitCore | ||
| version | property |
version:String [read-only] Returns the version number.
public static function get version():String| visualDisplayRoot | property |
visualDisplayRoot:DisplayObjectContainerAllows you to get or set the appropriate visualDisplayRoot for this test run. Mainly used in ActionScript only projects to provide a reference to the main sprite
public function get visualDisplayRoot():DisplayObjectContainer public function set visualDisplayRoot(value:DisplayObjectContainer):void| FlexUnitCore | () | Constructor |
public function FlexUnitCore()
Create a new FlexUnitCore to run tests.
| addListener | () | method |
public function addListener(listener:IRunListener):voidAdd a listener to be notified as the tests run.
Parameters
listener:IRunListener — the listener to add
|
See also
| addUncaughtErrorListener | () | method |
public function addUncaughtErrorListener(loaderInfo:LoaderInfo, priority:int = 1):voidAdds a generic listener for errors. In practice this is used to catch global errors to ensure that, if a developer does not properly code an async test using FlexUnit APIs, that the player is not stopped by a message dialog Receiving this top level error is erybad and causes an immediate stop.
Parameters
loaderInfo:LoaderInfo — the listener to add
| |
priority:int (default = 1) |
See also
| beginRunnerExecution | () | method |
protected function beginRunnerExecution(runner:IRunner):void
Starts the execution of the IRunner.
Parameters
runner:IRunner |
| pleaseStop | () | method |
public function pleaseStop():voidRequests that the FlexUnitCore stop execution of the test environment. As Flash Player is single threaded, we will only be able to stop execution after the currently running test completes and before the next one begins, so this will always have a margin of error.
| removeListener | () | method |
public function removeListener(listener:IRunListener):voidRemove a listener.
Parameters
listener:IRunListener — the listener to remove
|
| run | () | method |
public function run(... args):void
Determines what classes can be found in the provided args. If any classes
have been reported but are missing, those classes will be reported as failures in the returned
Result. The classes that are found in the arguments will be wrapped into a
Request, and that Request will be used for the test run.
Parameters
... args — The arguments are provided for the test run.
|
| runClasses | () | method |
public function runClasses(... args):void
Wraps the class arguments contained in args into a Request.
The classes that are found in the arguments will be wrapped into a
Request, and that Request will be used for the test run.
Parameters
... args — The class arguments that are provided for the test run.
|
| runRequest | () | method |
public function runRequest(request:Request):void
Runs the classes contained in the Request using the IRunner of
the Request. Feedback will be written while the tests
are running and stack traces writes will be made for all failed tests after all tests
complete.
Parameters
request:Request — The Request describing the IRunner to use for
for the test run.
|
| runRunner | () | method |
public function runRunner(runner:IRunner):void
Runs the tests contained in IRunner if all IAsyncStartupRunListerners
are ready; otherwise, the the test run will begin once all listeners have reported that they
are ready.
Once the test run begins, feedback will be written while the tests are running and stack traces
writes will be made for all failed tests after all tests complete.
Parameters
runner:IRunner — The IRunner to use for this test run.
|
| Event |
flash.events.Event| Event |
flash.events.Event| Event |
flash.events.Event| RUNNER_COMPLETE | Constant |
public static const RUNNER_COMPLETE:String = runnerComplete| RUNNER_START | Constant |
public static const RUNNER_START:String = runnerStart| TESTS_COMPLETE | Constant |
public static const TESTS_COMPLETE:String = testsComplete| TESTS_STOPPED | Constant |
public static const TESTS_STOPPED:String = testsStopped