Packagesrc.main
Classpublic class FunFX
InheritanceFunFX Inheritance flash.display.Sprite
SubclassesFunFXMock

Adapter that enables the Ruby framework Funfx to functionally test flex applications.



Protected Properties
 PropertyDefined by
  applicationRoot : Object
[read-only] A getter method to the Application.application.root It eases the testing
FunFX
  automationManager : IAutomationManager
[read-only] A getter method to the Automation.automationManager It eases testing
FunFX
Public Methods
 MethodDefined by
  
FunFX(root:DisplayObject)
FunFX
  
applicationReady(str:String):Boolean
[static] Checks wether the application root is ready/initialized or not
FunFX
  
[static] Sets the adapter in recording mode
FunFX
  
catchEvent(eventType:String, eventClass:String, objectID:String, properties:Object = null):String
The method the testing framework (Ruby implemented Funfx) access to perform events.
FunFX
  
catchProperty(objectID:String, property:String):*
Checks the value of an objects property.
FunFX
  
checkComponent(parentID:String, name:String):*
Helps the Funfx framework to figure out if the object exist in the application.
FunFX
  
checkName(obj:UIComponent, name:String):Boolean
Takes a display object and a name, and checks different values on the object to see if it matches the name.
FunFX
  
endRecording():void
Makes the adapter leave the recording mode
FunFX
  
findObject(parentID:String, name:String):IAutomationObject
Uses the objectTree string, which is a comma separated string, to go through the display object hierarchy to find the wanted object.
FunFX
  
getChildren(objectID:String):String
Helper method for displaying the children of a component Is used to ease writing tests, finding the right children
FunFX
  
getColumnNames(objectID:String):String
Returns the column names of a component supporting tabular data e.g.
FunFX
  
getFirstVisibleRow(objectID:String):int
Returns the index of the first visible row in a component supporting tabular data e.g.
FunFX
  
getHierarchy(obj:IAutomationObject):String
[static] Prints the hierarchy of parent to the object in Ruby syntax.
FunFX
  
getLastVisibleRow(objectID:String):int
Returns the index of the last visible row in a component supporting tabular data e.g.
FunFX
  
getNumColumns(objectID:String):int
Returns the number of columns in a component supporting tabular data e.g.
FunFX
  
getNumRows(objectID:String):int
Returns the number of rows in a component supporting tabular data e.g.
FunFX
  
getTabularDataValue(objectID:String, arg:Object):String
FunFX
  
getTabularDataValues(objectID:String, start:int = 0, end:int = 0):String
Extracts and passes the values of an object that supports tabulardata (ex DataGrid, List etc) to the testing framework.
FunFX
  
init(root:DisplayObject):void
[static] Init method that initializes the adapter class when added as a library to a Flex application.
FunFX
  
isSynchronized(objectID:String):Boolean
Method that checks whether the Flex application is ready or busy doing some action.
FunFX
  
resolveObjFromID(objectID:String):UIComponent
Method that resolves the object from the cerated ID
FunFX
  
setProperties(replayEvent:*, object:UIComponent, properties:Object):String
Merges the properties added by the framework to the actual event
FunFX
  
setTestingEnvironment(te:String):void
Sets the testing environment, with a XML file that describes all the Flex components.
FunFX
Protected Methods
 MethodDefined by
  
createID(obj:IAutomationObject):String
A help method to create the ID for the object.
FunFX
  
performSearch(openList:Array, name:String):UIComponent
Uses a breadth first algorithm to find the object.
FunFX
  
resolveID(objectID:String):Array
Helper method for resolving the object from the ID.
FunFX
  
startPlayback(obj:IAutomationObject, ev:Event):void
Initiates the event on the object.
FunFX
  
startSearch(name:String):UIComponent
A helper method that is used to find the first display object from the System manager.
FunFX
Property detail
applicationRootproperty
applicationRoot:Object  [read-only]

A getter method to the Application.application.root It eases the testing

Implementation
    protected function get applicationRoot():Object
automationManagerproperty 
automationManager:IAutomationManager  [read-only]

A getter method to the Automation.automationManager It eases testing

Implementation
    protected function get automationManager():IAutomationManager
Constructor detail
FunFX()constructor
public function FunFX(root:DisplayObject)Parameters
root:DisplayObject
Method detail
applicationReady()method
public static function applicationReady(str:String):Boolean

Checks wether the application root is ready/initialized or not

Parameters
str:String — With ExternalInterface the method must provide some arguement

Returns
Boolean — A Boolean value indicating if the application is ready or not
beginRecording()method 
public static function beginRecording():void

Sets the adapter in recording mode

catchEvent()method 
public function catchEvent(eventType:String, eventClass:String, objectID:String, properties:Object = null):String

The method the testing framework (Ruby implemented Funfx) access to perform events. It receives the object and the event that will be performed on the object. It creates the event and if the properties argument is set, it uses the method setProperties to merge the properties of the event. The event and object is sent to the method startPlayback.

Parameters
eventType:String — The event eg. flash.events::MouseEvent
 
eventClass:String — The type of event eg. Click
 
objectID:String — The id of the object, String/AutomationID
 
properties:Object (default = null) — The properties of the event, an XML object

Returns
String — The error message if one is created, or null if the replay was successfull.

See also

setProperties
startPlayback
mx.automation.AutomationID
catchProperty()method 
public function catchProperty(objectID:String, property:String):*

Checks the value of an objects property.

Parameters
objectID:String — The id of the object, String/AutomationID
 
property:String — the property of an object the framework wants to check its value

Returns
* — the value of the property

See also

mx.automation.AutomationID
checkComponent()method 
public function checkComponent(parentID:String, name:String):*

Helps the Funfx framework to figure out if the object exist in the application. Uses the methods findObject and createID.

Parameters
parentID:String — The id of the object, String/AutomationID
 
name:String

Returns
* — A boolean value indicating if the object exists or not

See also

findObject
createID
mx.automation.AutomationID
checkName()method 
public function checkName(obj:UIComponent, name:String):Boolean

Takes a display object and a name, and checks different values on the object to see if it matches the name.

Parameters
obj:UIComponent — The display object
 
name:String — The name of the desired display object

Returns
Boolean — Indicating that the display object is correct or not
createID()method 
protected function createID(obj:IAutomationObject):String

A help method to create the ID for the object. It is created to ease testing.

Parameters
obj:IAutomationObject — The display object

Returns
String — The id created with the help from AutomationID

See also

mx.automation.AutomationID
endRecording()method 
public function endRecording():void

Makes the adapter leave the recording mode

findObject()method 
public function findObject(parentID:String, name:String):IAutomationObject

Uses the objectTree string, which is a comma separated string, to go through the display object hierarchy to find the wanted object. It uses the methods startSearch and performSearch to achieve this goal.

Parameters
parentID:String — The id of the parent object, String/AutomationID
 
name:String — The name of the object

Returns
IAutomationObject — The object found, if noe object found it returns null

See also

startSearch
performSearch
mx.automation.AutomationID
getChildren()method 
public function getChildren(objectID:String):String

Helper method for displaying the children of a component Is used to ease writing tests, finding the right children

Parameters
objectID:String — The id of the object, String/AutomationID

Returns
String — A String showing all the children with names.

See also

mx.automation.AutomationID
getColumnNames()method 
public function getColumnNames(objectID:String):String

Returns the column names of a component supporting tabular data e.g. datagrid, list, combobox

Parameters
objectID:String — The id of the object, String/AutomationID

Returns
String — The column names

See also

mx.automation.AutomationID
getFirstVisibleRow()method 
public function getFirstVisibleRow(objectID:String):int

Returns the index of the first visible row in a component supporting tabular data e.g. datagrid, list, combobox

Parameters
objectID:String — The id of the object, String/AutomationID

Returns
int — The index of the first visible row

See also

mx.automation.AutomationID
getHierarchy()method 
public static function getHierarchy(obj:IAutomationObject):String

Prints the hierarchy of parent to the object in Ruby syntax. It will be used together with the FunFX recording tool. This method is only created, so that the adapter is partly ready for the recording tool.

Parameters
obj:IAutomationObject — IAutomationObject recorded

Returns
String — A string representing the hierarchy
getLastVisibleRow()method 
public function getLastVisibleRow(objectID:String):int

Returns the index of the last visible row in a component supporting tabular data e.g. datagrid, list, combobox

Parameters
objectID:String — The id of the object, String/AutomationID

Returns
int — The index of the last visible row.

See also

mx.automation.AutomationID
getNumColumns()method 
public function getNumColumns(objectID:String):int

Returns the number of columns in a component supporting tabular data e.g. datagrid, list, combobox

Parameters
objectID:String — The id of the object, String/AutomationID

Returns
int — The number of columns

See also

mx.automation.AutomationID
getNumRows()method 
public function getNumRows(objectID:String):int

Returns the number of rows in a component supporting tabular data e.g. datagrid, list, combobox

Parameters
objectID:String — The id of the object, String/AutomationID

Returns
int — The number of rows

See also

mx.automation.AutomationID
getTabularDataValue()method 
public function getTabularDataValue(objectID:String, arg:Object):StringParameters
objectID:String
 
arg:Object

Returns
String
getTabularDataValues()method 
public function getTabularDataValues(objectID:String, start:int = 0, end:int = 0):String

Extracts and passes the values of an object that supports tabulardata (ex DataGrid, List etc) to the testing framework. One can choose what rows/columns or 0,0 to choose all.

Parameters
objectID:String — The id of the object, String/AutomationID
 
start:int (default = 0) — The start column/row
 
end:int (default = 0) — The end column/row

Returns
String — The tabular values in a comma separated list.

See also

mx.automation.AutomationID
init()method 
public static function init(root:DisplayObject):void

Init method that initializes the adapter class when added as a library to a Flex application.

Parameters
root:DisplayObject — The Flex application
isSynchronized()method 
public function isSynchronized(objectID:String):Boolean

Method that checks whether the Flex application is ready or busy doing some action.

Parameters
objectID:String — The id created by AutomationID describing the object

Returns
Boolean — Boolean value indicating if the application is synchronized

See also

mx.automation.AutomationID
performSearch()method 
protected function performSearch(openList:Array, name:String):UIComponent

Uses a breadth first algorithm to find the object. The closest objects are put in an openlist and the investigated items that are not the one searched for are put in a closed list. It moves down in the hierarchy until the object is found. The method checkName is used to see if the object is correct or not.

Parameters
openList:Array — The list of objects not investigated
 
name:String — The name of the object

Returns
UIComponent — The object found, or null if not found.

See also

checkName
resolveID()method 
protected function resolveID(objectID:String):Array

Helper method for resolving the object from the ID. Made to ease testing.

Parameters
objectID:String — The id of a object created with mx.automation.AutomationID

Returns
Array — Array

See also

mx.automation.AutomationID
resolveObjFromID()method 
public function resolveObjFromID(objectID:String):UIComponent

Method that resolves the object from the cerated ID

Parameters
objectID:String — The id of the object, String/AutomationID

Returns
UIComponent — The object resolved from the ID.

See also

mx.automation.AutomationID
setProperties()method 
public function setProperties(replayEvent:*, object:UIComponent, properties:Object):String

Merges the properties added by the framework to the actual event

Parameters
replayEvent:* — The event that will be replayed
 
object:UIComponent — The object the event will be performed on
 
properties:Object — The event properties, an XML object

Returns
String — The error message, if one is created, or null if it was successful.
setTestingEnvironment()method 
public function setTestingEnvironment(te:String):void

Sets the testing environment, with a XML file that describes all the Flex components. It uses the private method xmlLoaded and the classes created by Adobe.

Parameters
te:String — Testing environment filename
startPlayback()method 
protected function startPlayback(obj:IAutomationObject, ev:Event):void

Initiates the event on the object.

Parameters
obj:IAutomationObject — The display object on which the event is performed on
 
ev:Event — The event to be performed
startSearch()method 
protected function startSearch(name:String):UIComponent

A helper method that is used to find the first display object from the System manager. After the first object is discovered, it uses the performSearch method to locate the next objects

Parameters
name:String — The name of the object

Returns
UIComponent — The object found or null

See also

performSearch