Flex 3.4 and Flex4 Automation Delegate source code
If you are a Flex Automation test tool user/provider and trying to find how to get the source code of Automation Delegates for Flex SDK 3.4 and 4, get the beta of FlashBuilder downloaded.
FlashBuidler 4 (previously known as FlexBuilder) Beta2 is out and available on Adobe Labs. http://labs.adobe.com/technologies/flashbuilder4/ .
you can find the source from <installedlocation>/sdks/<sdkversion>/frameworks/projects starting with atuomation.
/
1 comment October 27, 2009
Flex 4 Automation – New feature list
In Flex4 (the beta available) , automation framework supports the following new features.
- AIR automation.
- Marahshalling support for Flex and AIR application. (multi version , different application domain, different security domain etc)
- Modified custom control handling.
- Trail for spark automation (only some components are enabled in Beta2)
- Performance improvement in replaying the script
etc…
However the testing tools using the automation framework need to do certain modifications to leverage these new features.
AIR automation of flex controls this includes
-
Windowed application.
-
Multiple window.
-
Drag and drop operations inside AIR applications.
How to get the multiwindow details :
The windows are not children of Application in fact in all-purpose they are independent application instance. Even after closing the main application window the sub application can exists.
Now the automationManager listens to the user interaction on the sub Windows also and will dispatch the record event on these also similar to as it handled on the main window.
The change needed in the tools
You can listen to the AutomationAirEvent.NEW_AIR_WINDOW from the AutomationManager and get the uniqueId formed for this new window by the automationManager.
You can get the window corresponding to the id from using getAirWindow API on the AutomationManager2 passing the window id. You have to ensure the object received is valid. (e.g. getting the window object after the window is closed).
If your tool needs to get the hwnd of the new window, there is no direct way. However this can be logically handled. If you would like to know more about this, or about any of the new features, you can contact me at ranik@adobe.com (I will try to address this more in further posts as time permits
)
Add comment October 9, 2009
IE7 and FlexBuilder3 plugin not working for automation using QTP ?
Are you using FlexBuilder3 plugin and IE7? Tere was a issue with the Flex Builder 3 Plugin when used with IE7 (http://bugs.adobe.com/jira/browse/FLEXENT-770 ).
This issue was resolved from Flex Builder 3.2 onwards. Please follow the steps below to get the latest plugin.
- Uninstall the existing flex plugin
- Download the last Flex Builder 4 QTP plugin zip file http://download.macromedia.com/pub/labs/flex/4/flex4_automation_install_100509.zip
- Unzip it in a permanent location and then click on the Install_QTP_Plugin.bat and then restart your machine.
- Now try recording the automatable flexstore application http://www.adobe.com/devnet/flex/samples/flex_store_v2/
Add comment October 7, 2009
Using Ant sccript to compile the flex application and enable automation.
If you are using ant script to compile your application and if you would like to link in the automation libraries , you need to use the appropriate compiler arguments. Please note that placing the automation libraries in the library path and providing the library path using the compiler.library-path wont enable the applications for automation.
Automation classes wont be added to the application by the compiler just by placing the libraries as the application code does not refer to the automation classes. So the classes needs to be linked in to the application forcefully using the -include-libraries option.
In the ant script this can be used as follows.
This needs to be used in the mxmlc task.
<mxmlc file=”${APP_ROOT}/Main.mxml” keep-generated-actionscript=”true”>
<compiler.include-libraries dir=”${swf.output}” append=”true”>
<include name=”MyComponents.swc” />
<include name=”AcmeComponents.swc” />
<include name=”DharmaComponents.swc” />
</compiler.include-libraries>
</mxmlc>
For more details refer http://livedocs.adobe.com/flex/3/html/help.html?content=anttasks_1.html
Add comment October 7, 2009
FlashBuilder 4 – Beta2 is out. Spark components automation for trial
FlashBuidler 4 (previously known as FlexBuilder) Beta2 is out and available on Adobe Labs. http://labs.adobe.com/technologies/flashbuilder4/ check out the new features.
In beta2, Spark components automation is available for trial.
Spark Components made automation ready for Beta 2
- Application
- Button
- CheckBox
- Panel
- RadioButton
- ScrollBar
- TextArea
- TextInput
- VGroup
- HGroup
- RichEditableText
- Slider
- NumericStepper
Automation of these Spark Components is currently supported only for Flex Applications.
Read more about it from the release notes http://labs.adobe.com/wiki/index.php/Flash_Builder_4:Release_Notes#Install_and_Configure_Flex_and_AIR_Automated_Testing
Try out this and let us know your feedback. Refer http://labs.adobe.com/wiki/index.php/Flash_Builder_4:Release_Notes#Flex_SDK_Issues - automation for the known issues.
Add comment October 6, 2009
Using FileReference.browse or FileReference.download ?
In the work flow, if you were using FileReference.browse or FileReference.download, the script replay can fail if you are using the Flash player 10.
Flash player 10 security features does not allow action script level programatic reply of events which triggers the above operations. i.e These operations work only if it was triggered by the user interaction such as actual mouse click or keyboard click.
Since the automation framework replay happens at the action script level (using the low level events being dispatched on the targets), this will be blocked by the security restriction.
The flash player 10 security enhancement documentation states “In Flash Player 9, ActionScript could perform uploads and downloads at any time. With Flash Player 10, the FileReference.browse and FileReference.download operations may be initiated only through ActionScript that originates from user interaction. This includes actions such as clicking the mouse or pressing the keyboard. “
More about it at http://www.adobe.com/devnet/flashplayer/articles/fplayer10_security_changes_02.html#head3
Add comment October 6, 2009
How to use automation source in FlexBuilder3
Not able to locate the automation source ?
Do you have a valid professional FB license ? If yes, read further.
As we discussed in the earlier posts, the automation libraries are automation.swc, automation_dmv.swc, automation_flashflexkit.swc
You can find the source for this as follows.
automation.swc -> C:\Program Files\Adobe\Flex Builder 3\sdks\3.0.0\frameworks\projects\automation
automation_dmv -> C:\Program Files\Adobe\Flex Builder 3\sdks\3.0.0\fbpro\projects\automation_dmv
automation_flashflexkit -> C:\Program Files\Adobe\Flex Builder 3\sdks\3.0.0\fbpro\projects\automation_flashflexkit
Missing fbPro?
If you have a valid professional FlexBuilder license and if you are missing the fbpro location you can get the source in 2 ways.
1. Go to c:/Documents and Settings/All Users/Application Data/Adobe/Flex ( this is the license-file-location)
2. You will find a file known as license.properties . Take a backup copy of this file and delete it
3. restart your FB. Apply the license again (either you may be asked to enter in the start up itself , else using Help -> manage flexLincense)
4. Once the key is accepted and informed as a valid professional key, check for the fbpro folder again.
Still Missing?
FB is supposed to extract the source and 2.0.1 automation libraries, when the key is accepted. But looks like in some cases, it is not. In those case you can get the source as follows
1. go to C:\Program Files\Adobe\Flex Builder 3\sdks\3.2.0\lib
2. Check whether you have DMV-source.jar there
3. You should have it. you can extract the source from command line as
java -jar DMV-source.jar {license-file-location} {output-location}
you can find more details on this at http://blogs.adobe.com/flexdoc/2008/04/extracting_data_visualization.html
How to use the source for debugging?
If you like to add this source to debug your project.
1. right click on project -> properties
2. Select the Flex Build Path
3. In the source Path tab select the location of the source till src (e.g C:\Program Files\Adobe\Flex Builder 3\sdks\3.2.0\fbpro\projects\automation_dmv\src)
If your project was including the swc corresponding to this source, now it will compile using the source. So you can edit the source, you can add break point and debug.
1 comment September 24, 2009
Locale libraries for automation
One has to keep in mind that Automation is a feature supported from Flash Builder/FlexBuilder. So if anybody is using a nightly build sdk, they need to ensure that they provide all the required pieces for automation to work.
Automation need the automation libraries and the locale libraries. (refer http://raniskumar.wordpress.com/2009/08/13/how-to-enable-flex-automation/ for details)
You can place these libraries anywhere on your machine add the paths in the build path of your project. Even though the main automation libraries (atuomation.swc, automation_agent.swc etc) needs to be added using -include-libraries, the locale libraries can be just placed along with the other locale libraries in the appropriate locale folders.
Since flex3 sdk support English and Japanese only, automation also support these. However in Flex4 many more languages are supported. So theoretically these libraries can be used.
If you are in real emergency to compile an application in an unsupported language, before your translations and the correct locale swc is ready, you can try changing the locale/{foldername} in an available swc to the required locale .You can use the normal zip utilities to open the swc and recreate it.(I have not tried it personally, theoretically this should work).
Note: The locale libraies for automation are
- automation_rb.swc
- automation_agent_rb.swc
- qtp_air_rb.swc
Add comment September 22, 2009
More about showInAutomationHierarchy
In one of the previous post regarding the slow replay, I have refered using showInAutomationHierary. Here i am trying to cover the conceptual details of this property. So when a new component is developed, one can decide about the appropriate value of this accordingly.
In Automation, information about an object is the collection of object information from the application till the object is reached. So basically if an object has the hierarchy as Application.Panel.HBox.VBox.Form.Button the script also should look like the same. But this will have two impacts. One long script lines, which indirectly means more objects details to represent the button.
So from the beginning of the Automation support the decision is made as follows. The non visual containers wont be shown in the script. Which means in the above example, HBox and VBox wont be shown in the list.
This information is represented in the “showInAutomationHierarchy” property of an object. In automation framework it has more meaning to it. Automation framework analyses all children of a container to find the automationIndex of a certain object. (refer the pic in the slow replay). So in the case of the example above, all children of the Panel will be the collection of all its container children who are not visible in the AutomationHierarchy. i.e here the tree will be flattened till the hierarchy reaches a visible object in the chain.
So, let us take an example of Application.Panel.TextInput.Input as the scriptline vs its actual structure of Application.Panel.HBox.VBox.TextInput.Input
Note: The picture represents the details from Panel.
So here even though Panel had only 3 children, since the HBox an VBox are not visible in he hierarchy, it has 6 children when analysing the children in automation framework.
So the automation hierarchy will be as follows

The logic of these value in some of the framework classes is explained to make the concept clearer.
The container in flex framework has been set false for this property. So any component which is inherited from the container, if visible in the application and found logical to be seen in the script, can set these values true.
So in container.as it can be seen that showInAutomatioHierarchy = false; and the other visible containers set these values to true. (e.g Panel, Form , accordion, View Stack etc
And reverse is applicable for a component. i.e by default uiComponent this value is true and any component which inherits from UIComponent but does not really represent a visual component can make this flag set to false. e.g SWFLoader. But an Image which is inherited from SWFLoader makes this as true as it is a visible component.
Even though framework sets these values as preferred for the default usage, the application developer can change the default values by setting the appropriate value for these in the application code itself.
e.g <mx:HBox showInAutomationHierarchy=”true” />
2 comments September 14, 2009
How to automate MouseMove interactions?
In Automation, by design the recording of lower level events are prevented. This is mainly to avoid the unintended recording of events. Let us take the example of mouse move. If the automation records the mouse move on any componet, as the user moves the mouse over the application itself, there will get a huge list of unintended script lines. So it makes sense not to unnecessarily increase the script size.
But many application uses mouseMove jesture in many case to bring up menu’s. Let us take when the user mouse over an image the applicaiton display a menu and the user clicks on the menu. In this case, user click on the menu will be recorded. But since the mouse over was not recorded, while replaying, the menu itself would not have come up and further work flow will break.
To handle this situation, automation framework allows mouseMove as a replayable event. i.e user can add the script line manually and during the replay of the script, the work flow will happen as expected.
A sample script line can look as follows.
Browser(“Browser”).FlexApplication(“TicketReservation”).FlexImage(“SelectOption”).MouseMove
Add comment September 10, 2009