Steps required to automate a flex application

12 06 2009

Flex automation has been around for a long time but i still felt the need for this blog entry in order to welcome new users and to make their first step into the flex automation world a little easier.

Just follow the steps below and you should be able to start automating in no time.

  1. First you need to ensure that you have qtp installed on your machine (qtp version 9.5 or 9.2).
  2. Now download the qtp installer from here
  3. Unzip the file and click on Install_QTP.bat file.
  4. Now go to your flex project in flex builder and go to Project->Properties->Flex Compiler and in the additional compiler arguments text box enter replacing flash_builder_root with your install directory : -include-libraries “flash_builder_root\sdks\4.0.0\frameworks\libs\automation\automation.swc” “flash_builder_root\sdks\4.0.0\frameworks\libs\automation\automation_agent.swc” “flash_builder_root\sdks\4.0.0\frameworks\libs\automation\qtp.swc” “flash_builder_root\sdks\4.0.0\frameworks\libs\automation\automation_dmv.swc”
  5. Click on Apply and OK and go to Project->clean and clean the corresponding project.
  6. Now start QTP and select Flex and web add-in in the add in manager screen of QTP.
  7. Now run your application.
Advertisements

Actions

Information

24 responses

2 09 2009
Albert Hartland

Hi, i’m new to QTP and flex. Can I assume that version 4 of the Flex plugin for QTP (available as a download link in the post) can record and interact with a flex3 application?

There are some issues that my collegues are having ( http://bugs.adobe.com/jira/browse/FLEXENT-789 ) and I wondered if upgrading the QTP plugin is likely to help.

TIA

2 09 2009
svakil

Hi Albert
Let me answer your question in parts
1.Can I assume that version 4 of the Flex plugin for QTP (available as a download link in the post) can record and interact with a flex3 application? -Yes the flex plugin is backward compatiable.
2.There are some issues that my collegues are having ( http://bugs.adobe.com/jira/browse/FLEXENT-789 ) and I wondered if upgrading the QTP plugin is likely to help. -Unfortunately upgrading the Flex plugin will not help in this problem.The fix has been done in the automation swcs so your colleagues will have to upgrade their application from flex 3 sdk to flex 4 and use the corresponding automation swcs.For that your colleagues will have to wait for our next flex 4 Beta release which will be sometime in October.In the meantime they could try making some changes to their application structure as suggested in the bug.

4 11 2009
Matt

Great posts here. Do you know where to actually get the automation libraries? I have some (from somewhere) for sdk 3.4.1.10084, but now want to build with 3.3. I can’t find the automation libs for 3.3, 3.2, 3.1, 3.0. I’ve read that they’re unchanged for those sdk’s. I’ve downloaded these sdks, but find no automation libs included. Do you know where to look?

5 11 2009
svakil

Hi Matt
As Automation is a premium feature of Flex Builder you will have to install Flex Builder 3.0.2 and use the automation swcs present in Flex Builder 3.0.2\sdks\3.2.0\frameworks\libs these automation swcs are compatible with both sdk 3.2 as well as 3.3.You can download a trial version of flex Builder 3.0.2 from http://www.brothersoft.com/d.php?soft_id=80701&url=http%3A%2F%2Fdownload.macromedia.com%2Fpub%2Fflex%2Fflex_builder%2FFB3_win.exe

1 12 2009
Sachin Dev Tripathi

Thanks
really i was looking for a testing method to test my Flex application..bcz i am a developer so i hav’nt idea about testing packages.

12 02 2010
Mark S

Thanks for posting this by the way. A dev and I have been trying to figure out how to get our air application (using Flash 4 beta 2) built properly using the QTP air libraries (swc). Our Devs use a build.xml file which is basically a compile / deploy script.

Question is, should the devs run the Install_QTP.bat batch file on their dev machines as well to make this work?

We got to the point where it looks like we are incorporating the qtp libraries (waiting on qtp connection message shows up). But it looks like its not being compiled properly because basic functions / buttons are not working properly when we include the QTP libraries. We are running out of ideas so maybe you have experienced this before and might have some insight? Thanks, Mark

15 02 2010
svakil

Hi Mark
If the devs are going to just develop the air app and give it to you on a separate machine to test there is no need to instal QTP and subsequently the QTP flex add in.I would suggest that they complete developing their air app without compiling it with Automation swcs and once they are done import the project on the machine that has QTP and the QTP Flex add in installed .Then compile and run the project with automation swcs( you will need to start QTP before you run the air app so that the connection btw the air app and qtp is made).You will get a message sayin the “Connection to QTP is successfully made” .Once you get this machine your good to go.You could also refer to this post for more details https://shanazvakil.wordpress.com/2009/06/01/automation-testing-of-air-apps-now-in-flash-builder-4-beta/ Hope this helped!

16 02 2010
Mark S

Thanks for the reply svakil. At this point in our Air automation attempt, we have done the procedure suggested on the link. Unfortunately, after the the message “Connection to QTP is successfully made” goes out, we then attempt to run a manual walkthrough of the function we wanted tested.

Just to give you an idea of what we’re encountering, ill relay the situation. We have a login function on the first page and it looks like the button to initiate login is not working. Same goes for when the user press enter on the username or password. So we’re thinking that when we statically compile the Air code with the included QTP libraries, it then breaks our app. We are assuming that these qtp libraries are only used as hooks for QTP to monitor and not make any changes to the code.

9 03 2010
ARC

Hi,

I am able to record and playback the sample flexstore application in QTP 10 using the Runtime loading method mentioned here (http://livedocs.adobe.com/flex/3/html/help.html?content=functest_components2_05.html). This means that my Flex Automation setup is Okay.

The actual application that i need to automate loads external swf files so I am using following code to load my flex app with runtime loading support (as mentioned in the article):

But the application does not load and there is no error either, just blank flex page.

Please point out what I am missing here.

Thanks.

9 03 2010
ARC

Code is missing from my post!? please see “Testing applications that load external libraries” at http://livedocs.adobe.com/flex/3/html/help.html?content=functest_components2_05.html. I trying to use this code.

Thanks

9 03 2010
svakil

Hi
Firstly run time loading will not work when you are loading multiple swfs.You will need to compile all the swfs statically with automation swcs for AT to work.Which sdk are u using to compile your application? Because from sdk 3.0.2 onwards we have supported a feature called marshalling i.e irrespective of whether your swfs are added in the same or different application/security domain QTP will be albe to recognise all the swfs.please find the sample code using swfloader to load your swfs.

9 03 2010
ARC

Hi,

Thanks svakil for you reply. We are using 3.0.1but we are moving to 3.5 in next build.
By external swfs i mean my application consists of multiple swf files but they all are present on in the same webapps directory.

You mentioned “marshaling” can I load automation support at run time using marshaling? and if not then is there any way of loading automation support at runtime instead of making two builds in my case?

Thanks.

9 03 2010
svakil

Hi
No Im sorry runtime loading is only effective if you are using a single swf.You will need to use static compilation.

16 03 2010
ARC

Hi,

Is there any plan in future to remove this limitation/requirement of two separate builds (one for automated testing and other for deployment)?

Regards

17 03 2010
svakil

Hi
Currently also if you are referring to flex automation there is a way of using the same build if you were to use runtime loading of Automation swcs.For more detials on how to do this please refer Use run-time automated testing (recommended) for Flex Applications section in this link http://labs.adobe.com/wiki/index.php/Flash_Builder_4:Release_Notes#Use_run-time_automated_testing_.28recommended.29_for_Flex_Applications

18 03 2010
ARC

Hi,

But you mentioned earlier runtime loading is only effective if you are using a single swf. my application consists of multiple swfs (i.e I have one main swf e.g HomePage.swf that when called in return calls other swfs as needed) and like you said runtime loading wont work in this case.

What I wanted to know was is there any plan in future to remove this limitation/requirement of generating two separate builds (one for automated testing and other for deployment) in case of multiple swfs?

Thanks.

18 03 2010
svakil

Oh sorry i didnt realise that question was with reference to multiple swfs ,No Im sorry as of now there is no plans to support runtime loading for multiple swfs.

21 05 2010
Prashant

Hi svakil,

I am using Flex 3.2 and i have QTP9.5 and QTP 10 trail version; Can any one please let me know the steps How i enable my QTP 10 for testing flex 3.2 application.

-Prashant

21 05 2010
svakil

Hi prashant you dont need to do anything specifc to enabled qtp 10 to work .You can just follow the steps in blog entry https://shanazvakil.wordpress.com/2009/06/12/steps-how-to-automate-a-flex-application/ this works for qtp 10 as well 🙂

13 09 2010
bindu

hey i am not able to add the libraries. can you please help me in adding those libraries

14 09 2010
bindu

hp qtp version 9.5 is not able recognise the components on my webpage.. when i record a flex application i get only 1 line of code ..Can you please help me in tracing out the problem

14 09 2010
bindu

hey let me be clear with my question
1:i am using Flex Builder 3
2:automation files are from C:\Program Files\Adobe\Flex Builder 3\sdks\3.2.0\frameworks\libs
3:i am using HP Quick test proffesional version:9.5
4: i included the libraries as mentioned by you
5:flex4_test_automation_plugin is the plugin which i installed
6:i have checked air,flex and web plugins in the QTP
and now when i am trying to record the flex application , the components on the webpage are not recognised.

15 09 2010
svakil

Hi
Which Browser version are you using ?

15 09 2010
bindu

Internet Explorer 8

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




%d bloggers like this: