Posts filed under ‘Flex Automation’

Custom component Automation – Part III – Container class extending from non container class




Custom Component automation presentation


  •  read the part I session on custom component automation.…n-introduction

 read the part II session on custom component automation.

Custom component automation  – Container class extending from non container class

In this post I would try to explain the steps to be followed for handling the case of  a custom class which was extending from a non standard container class, but the class need to be treated as the container class.

e.g Your custom class MyClass extending from UIComponent (which is a non container standard framework class), eventhough as  a standard class it does not represent a container, it allows  to use the class as container programatically by using addChild, getChild etc. 

So if your extended class is meant to be a contianer (i,e if you woud like to get the children objects what you added in your base class), you need to program for the same.   The section explains how you can expose your children so that the user interaction on  those components can be supported. (e.g a button inside your contianer . Your script should look like

Application …… MyClass. childButton .click

i.e this sample does not cover how to expose events and user interaction on the MyClass. it coveres how the script can access the childButton in MyClass


  • Have your class MyClassAutomationImpl extend from UIComponentAutomationImpl
    • Refer the constructor and init in the sample delegate


  • Override the following methods (Note sample are only to explain the concept. It would not have followed all coding conventions)
    •  numAutomationChildren  – this method should have the logic to find the number of children in the component and return. If your component is a fixed element contianer you can provide this detials. If your component is a container to the user and number of children is based on usage, this need to be computed and returned. (for calculation logic samples refer application)         

               override public function get numAutomationChildren():int{return 2;}


    • getAutomationChildren  – return children – calculated and or known.

 override public function getAutomationChildren():Array{

var childrenArray:Array = new Array();



return childrenArray;


    • getAutomationChildAt- return children – calculated and or known.

override public function getAutomationChildAt(index:int):IAutomationObject{

if(index ==0)

return customContainer.button1;

else if (index ==1)

return customContainer.button1;


return null;


    • createAutomationIDPart- create the part information of the child. Automation framework already has the logic of calculating this.  This internally uses the automationName and automationIndex to calutate this. However if you have a separate logic for calculating these, you can pass your callback methods here. Else, simply copy pase the following lines.

override public function createAutomationIDPart(child:IAutomationObject):Object{

var help:IAutomationObjectHelper = Automation.automationObjectHelper;

return help.helpCreateIDPart(uiAutomationObject, child);


    •   createAutomationIDPartWithRequiredProperties– create the part information of the child only using the requried properties as part of the part object.  This internally uses the automationName and automationIndex to calutate this. However if you have a separate logic for calculating these, you can pass your callback methods here. Else, simply copy pase the following lines.

 override public function createAutomationIDPartWithRequiredProperties(child:IAutomationObject, properties:Array):Object{

var help:IAutomationObjectHelper = Automation.automationObjectHelper;

return help.helpCreateIDPartWithRequiredProperties(uiAutomationObject, child,properties);


    •   resolveAutomationIDPart– find the object using the part information.  This internally uses the automationName and automationIndex to calutate this. However if you have a separate logic for calculating these, you can pass your callback methods here. Else, simply copy pase the following lines.

 override public function resolveAutomationIDPart(part:Object):Array{

var help:IAutomationObjectHelper = Automation.automationObjectHelper;

return help.helpResolveIDPart(uiAutomationObject, part);


Have the entry for this class in the xml file.  For that you can do the follow.

  • Get the section of the base class entry in the existing xml file.
  • Copy the contents, change the details as appropriate
  • e.g
    <ClassInfo Name=”MyClass” GenericTypeID=”table” Extends=”FlexObject” SupportsTabularData=”false”>

<IconInfo IconFile=”TEAPluginQTP.dll” IconIndex=”207″/>


<Implementation Class=”mx.controls::MyClass”/>



April 12, 2010 at 8:50 am 13 comments

Custom component Automation – Part II

prerequisite:  read the part I session on custom component.…n-introduction

What all information is needed to make a flex component automatable.

1. Record  support of the user interactions.

2. Replay support of the recorded script.

3. Allowing verification of the properties of the object.

4.Allowing to get the tabular representation of the object (if applicable)

5. Provide test friendly methods to get specific data from the component.

These are done by different different components in the automation framework.

We will understand how each thing can be done. Now let us discuss mainly on the recording and replay aspect in the first step.

What all delegate should do?

Basically they

1. Provide the recording and replay of user interaction based component.

2. Provide information about its chidren and ways to access them, if they are a container type.

Let us discuss on this in details:

Provide recording.

1. Identify the events on the component which needs to be recorded.

2. Add event listeners for these events in the delegate.

3. Identify information which needs to be captured from the event, which can be later needed to recreate the event properly and identify the user interactable component.

4. Collect these information and pass to the automation manger to record. If these information is not part of the event (special case, we wil discuss this later. TBD)

5. Have an entry in the XML file to describe the event for the component which talks about the required arguments of the event.


Working with Delegates :

Let us take each of this case and address one by one.  I am planning to cover each of these case. As time permits i will cover and add the links here.

1. Extending from non container class, but current class is contianer.

refer –

2. Extending from contianer class, but current class would like to be treated as a single unit.

3. Item renderer automaiton

3. How to handle new events to existing classes/derived classes or handle less events of the existing/derived components.

4. How to get special data for testing from the component

5. How to get tabular data of the component etc…

April 12, 2010 at 6:11 am 6 comments

QTP versions and Supported IE Versions


The table  below shows the versions supported for the Flex plugins for QTP

QTP Version IE6 IE7 IE8
QTP 9.2 Yes No No
QTP 9.5 Yes Yes No
QTP 10 No Yes Yes

QTP10 and 1E6 also theoritically seem to work. But it is not a supported combination from Adobe as we have not done extensive testing on this combination.

December 7, 2009 at 11:06 am 4 comments

Enabling log for QTP 9.5

Please follow the  steps below to enabled Log for QTP 9.5

  1. Go to the command prompt and navigate to C:\Program Files\HP\QuickTest Professional\bin directory and invoke ClientLogs.exe.
  2. Select QTP in the left dialog.
  3. Select LogCatPackTEA and move it to the selected category.
  4. Change the Category level to Debug2 .
  5. Give the folder path where you want the log to be stored.
  6. Click on Apply.
  7. Restart QTP.

 Please not that there is a problem in QTP 9.5  such that when the user enables the QTP log recording does not work on flex applications. This issue has been resolved in QTP 10 and i beleive QTP has a patch to solve the issue for 9.5.  (I got a patch from QTP and it works on my machine)

If you are on 9.5 with all latest patch updated and if you are facing the recording issue, please let us know  (ideally a bug in JIRA – adobe bugbase) with the version details.


December 7, 2009 at 11:01 am 1 comment

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


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  (I will try to address this more in further posts as time permits 🙂  )

October 9, 2009 at 6:18 am 9 comments

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 ( ).

This issue was resolved from Flex Builder 3.2 onwards.   Please follow the steps below to get the latest plugin.

  1. Uninstall the existing flex plugin
  2. Download the last Flex Builder 4 QTP plugin zip file
  3. Unzip it in a permanent location and then click on the Install_QTP_Plugin.bat and then restart your machine.
  4. Now try recording the automatable flexstore application

October 7, 2009 at 6:42 am 6 comments

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” />


For more details refer

October 7, 2009 at 6:03 am 2 comments

Older Posts


July 2018
« May    

Posts by Month

Posts by Category