Friday, February 26, 2010

Test automation for Flex application

Few days ago I ran into the 'Using the automated testing API' by Adobe. It explain how to automation Flex application using QTP, 68 pages with lots of XMLs and other technical staff.

clip_image002clip_image004clip_image006

After 4 hours of reading I'm not positive I really can operate this thing. I'm not a Flex programmer and the document includes lots of Flex internals.

I must be missing something must it be so complicated?

I googled for a while and come up with amazingly simple solution:

SeeTest from Experitest. It took me less than 10 minutes to automate my first test. Following is a description of the process:

1. This is the application I would like to automate:
 image

It call the FlexStore and it's the demo application that come with Flex.
The flow I would like to automate is very simple: select a phone, add it to the cart and verify my basket amount is correct.

2. This is the SeeTest application:
image
You start by setting a project directory and then set the title of the application under test window in our case I selected 'FlexStore' (without the Mozilla Firefox).
image

3. Next thing is to take few screenshots of the application under test and graphically extract the required elements:
image
Just mark the element you would like to extract and set the element name:
image

4. OK this is how it look with all the element extracted:
image
You can see that when I select the element you can see it identification in the captured scene.

5. Now it is time to build a basic script, you should move to the screen tab and build the script:
imageI press the play button and it work (Amazing I'm less than 5 min into the process).
Now come the interest part. I would like to analyze the cart 'Grand Total' and verify it's $140.99:
image
I can extract the all element but it's not flexible enough when the amount changes I will have to extract it again.

6. Now comes the interesting part (I was really excited when I discovered it). I can use the multi extraction feature to learn all the number digit elements:
image
image
I don't know how they do it but the extracted element is identify even when the element color or background changes.

7. Next thing we should finish the script:
image
You can see that I uses the $140.99 as an open text.

8. Following video show the execution and the report result:



9. Now you can take my script and export to any programming language you like, I used JUnit: 
image

OK my 10 minutes are up and I’m with my first script running – COOL!

2 comments:

  1. Hi Ben,

    Nice Blog. Did you have a look at eggPlant from testplant.com for rich media apllications.

    Thanks,
    Sri

    ReplyDelete
  2. If SeeTest for free, i like it very much!

    ReplyDelete