Discussing the nuts and bolts of software development

Tuesday, March 02, 2010

 

RIATest: Automating Custom Components

RIATest is a GUI test automation tool for Adobe Flex applications. RIATest does for your GUI what FlexUnit does for your code, and it is available on Windows and Mac OS X. RIATest has number of useful features which can be very helpful, such as component inspector, script debugger, and synchronization capabilities. You can find the full list of features here.

When you specify actions that must be performed on your application the first thing you specify is what component you want to be located by RIATest so that an action can be performed on it. RIATest has few ways of locating components. One of the ways is locating component by label e.g. button with "Save" label can be located following way:

FlexButton("Save")

Component can be located in a same manner using components automatationName. You can also locate component using its automationIndex:

FlexButton("index:0")

In most of the cases you are getting every component which you need in the inspector, so you can easily locate those components. In case you derive a custom class from built-in container-type classes you usually do not need to do anything special to make children of your custom component available for automation since this is done by the automation delegate of base class.

However sometimes you implement a custom component that contains other components but your custom component is not derived from Container built-in class. If that is the case you need to expose components contained in your custom class. You will need to perform some additional steps to access them.

Let's discuss one exact example. Here we have a CustomPanel with a button added in its title bar. You will notice that the button which you just added is not visible in the inspector:


So what we can do? We need to implement automation delegate class for our custom component. Exposing child components is done by implementing numAutomationChildren/getAutomationChildAt pair of functions. numAutomationChildren function must return the number of children component for your custom class, getAutomationChildAt must return the child at the specified index. This means we need to implement automatation delegate class for our custom component to make Switch button accessible from RIATest.

numAutomationChildren

In our case we will need to return the number of children which are implementing IAutomationObject plus Switch button:
override public function get numAutomationChildren() : int {
    var count:int = 0;
    for(var i:int=0; i < comp.numChildren; i++) {
        if (comp.getChildAt(i) is IAutomationObject)
            count++;
    }
    return ++count;
}

getAutomationChildAt

getAutomationChildAt will need to return the child with a given index in case of index < numChildren and return Switch button in case of index == numChildren
override public function getAutomationChildAt( index : int ) : IAutomationObject {
    if (index >= 0 && index < comp.numChildren )
        return comp.getChildAt(index) as IAutomationObject;
    if(index == comp.numChildren)
        return comp.button;
    return null;
}

We will also need to implement init method in order to register our delegate class:
public static function init( root : DisplayObject ) : void {
    Automation.registerDelegateClass( CustomPanel, CustomPanelAutomationImpl);
}

The only thing left to do is to include our delegate into build, include your delegate class using additional compiler arguments:

-includes CustomPanelAutomationImpl

As you can see from the screenshot now Switch button is getting displayed in the inspector, so you can easily locate it:

FlexPanel("index:0")->FlexButton("Switch")=>click();

You can download source code of this project from here.

Comments:
Can you tell me if i must declare class infos in the classinfo file located in Riatest sub directory?

Thank you very much.
 
Really it was an awesome article...very interesting to read..You have provided an nice article....Thanks for sharing..
Android Training in Chennai
Ios Training in Chennai

 
If you want to know more about android hacks, https://cellspyapps.org/android-hacks/ will help you. I know it for sure.
 
This comment has been removed by the author.
 
Get the My Assignment Help Australia services at very cheap rates.
 
The composers of the Custom Economics Paper Writing Services are the leading ones in the industry as they give high quality Custom Economics Essay Writing Service and they assure originality of their Professional Economics Paper Writing Service.

 
Law Assignment Writing Services are hard to come across for those in need of Law Research Writing Services and law essay writing services.

 
Finding the best healthcare assignment writing services and Medical Assignment Writing Services is not easy unless one is keen to establish a reliable custom medical research paper provider & medical writing service help online.


 
It is very useful and top articles and I love this article. Some articles have no longer following the best however right here I new way of writing. captain marvel jacket
 
We're searching for web givers with a composing foundation who are energetic in carrying on with a real existence injected with the healthy and hand crafted love of farmhouse way of life to Write for us Technology. What does it take to be a web supporter? We have our eyes out for individuals who have their finger immovably on the beat.
 
RIATest is a very useful and effective application for getting help in the component inspector, script debugger, and synchronization capabilities. I always used to this application due to its latest and good features. Its performance is exceedingly good and it is available on Windows and Mac OS X. Essay Writing Services



 
To get 123 HP DeskJet 3830 default production line settings, you should think about the 123.hp.com/dj3830 hard reset. Find out about the HP DeskJet 3830 printer hard reset framework in detail. Get comprehensive insights concerning the default manufacturing plant settings and more about your 123.hp.com/dj3830 printer arrangement.
 
Reliable psychology essay writing help services are not hard to come across for those in need of Psychology Assignment Writing Services and psychology research writing services.

 
Hello, I need an economics assignment help with regression and unemployment. I am not able to describe everything here but I have submitted the entire task on your provided website for review. I just hope that I will get the right economics homework help from you. Should you have any questions on the work I have provided please feel free to contact me. In addition, let me know how much I need to pay for the work to be completed.

 
Hello, I need an economics assignment help with regression and unemployment. I am not able to describe everything here but I have submitted the entire task on your provided website for review. I just hope that I will get the right economics homework help from you. Should you have any questions on the work I have provided please feel free to contact me. In addition, let me know how much I need to pay for the work to be completed.

 
Any programmer that has used STATA for a while has probably used the option for their STATA assignment. You too could testify that you have used it in your STATA assignment help services But to some, it's not that very clear on how it works. But the simplest explanation that I can give about it is that it tries to process a command by grouping the variables. I used your statistics homework help services and I know a thing or two about your STATA team.

 
Do you have a C++ homework help tutor from Canada? I have a small programming assignment that can best be sorted by a C++ expert. The only reason why I want a programming homework help experts from our country is that I want someone who clearly understands our system. If you do not have any tutor from Canada the only other country I would consider is the United States. I will be waiting for your communication on the same.
 
I want to be honest with you. I am not the type of person who easily gets annoyed at people. Three months ago I sent you an email seeking communications system assignment help. My task was completed on time but after a struggle with the first Matlab assignment help, I was assigned. He was not responsive at all. I only enjoyed working with you after I demanded for a new Matlab homework help solver. The new person I was given was amazing. Always available when needed and a good communicator. I don’t know whether you allow people to decide who should handle their assignments because if it was possible then that is what I would do for the rest of my assignments.

 
I have a very urgent assignment which is required in less than 6 hours. Part of the work is done and therefore I need an economics assignment help expert to complete part three of the question and check whether I have done the other parts correctly. My budget for it is very minimal and therefore I don’t expect you to charge me more than $50 for the small remaining part. The beauty is that if I am happy with your solutions I'll need your economics homework help services again.

 
You are an experienced statistics homework help who has a bachelor's degree or a master's degree in statistics. I need your help in developing an appropriate study plan that can help me succeed in statistics. You have been there and clearly know what it takes to succeed in statistics. You can share some tips with me. Lastly let me know whether you offer SAS homework help. I am in dire need of a statistics assignment help expert with SAS knowledge.
 
People understand things differently. My brother told me that C++ was his simplest language when taking programming. When I started it proved to be my hardest language. Since I worked with your programming homework help team, I decided to hire your C++ homework help team to help me out. I want you to do all my assignments because I don’t seem to get anything in this class. I will also require some lessons from you.

 
The Matlab homework help expert who did my communication systems assignment provided a solution worse than what a high schooler would deliver. I was so frustrated because I had paid quite an amount of money for the task. Even after asking for revisions, the solution didn’t get any better. They had to assign the work to another Matlab assignment help expert and I was eventually provided with quality Matlab assignment help. Not the best experience but the second writer was really nice.

 
Do you work alone or do you work as a team? I want to hire you as my economics homework help expert but I am afraid that you may not handle the work alone. If you have other economics assignment help experts to help you then that would make more sense. I am concerned because I will not allow late work. My professor never accepts late work and therefore not delivering on time would mean a re-take.

 
Find Latest Job Vacancies In Noida, Delhi For Freshers And Experienced. Filter Job Opportunities By Salary, Experience, Industry, Company Etc ...

 
Post a Comment



<< Home

This page is powered by Blogger. Isn't yours?