Packageorg.flexunit.runner
Classpublic class FlexUnitCore
InheritanceFlexUnitCore Inheritance flash.events.EventDispatcher

FlexUnit4 Version: 4.2.0 The 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: Ultimately, FlexUnit4 runs one and only one request per run. So, if you pass it multiple classes, etc. these are all wrapped in a single 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

org.flexunit.runner.Request
org.flexunit.runner.Result
org.flexunit.runner.notification.IRunListener


Public Properties
 PropertyDefined 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
Public Methods
 MethodDefined 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
  
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
  
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.
FlexUnitCore
Protected Methods
 MethodDefined By
  
Starts the execution of the IRunner.
FlexUnitCore
Events
 Event Summary Defined By
  
FlexUnitCore
  
FlexUnitCore
  
FlexUnitCore
Public Constants
 ConstantDefined 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
Property Detail
versionproperty
version:String  [read-only]

Returns the version number.


Implementation
    public static function get version():String
visualDisplayRootproperty 
visualDisplayRoot:DisplayObjectContainer

Allows 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


Implementation
    public function get visualDisplayRoot():DisplayObjectContainer
    public function set visualDisplayRoot(value:DisplayObjectContainer):void
Constructor Detail
FlexUnitCore()Constructor
public function FlexUnitCore()

Create a new FlexUnitCore to run tests.

Method Detail
addListener()method
public function addListener(listener:IRunListener):void

Add 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):void

Adds 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():void

Requests 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):void

Remove 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 Detail
Event
Event Object Type: flash.events.Event

Event  
Event Object Type: flash.events.Event

Event  
Event Object Type: flash.events.Event

Constant Detail
RUNNER_COMPLETEConstant
public static const RUNNER_COMPLETE:String = runnerComplete

RUNNER_STARTConstant 
public static const RUNNER_START:String = runnerStart

TESTS_COMPLETEConstant 
public static const TESTS_COMPLETE:String = testsComplete

TESTS_STOPPEDConstant 
public static const TESTS_STOPPED:String = testsStopped