Archive for April, 2010

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


April 2010
« Dec   Jul »

Posts by Month

Posts by Category