flexui automation

14
Using Selenium IDE with FlexMonkium for Flex UI automation

Upload: rahulshende

Post on 22-Oct-2014

211 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: FlexUI Automation

Using Selenium IDE with FlexMonkium for Flex UI

automation

Page 2: FlexUI Automation

Introduction:

We can not use Selenium IDE alone for Flex UI automation as it does not capture the events on Flex UI. So for Flex UI automation we need some tool to be integrated with Selenium IDE, and then only we can record the events on Flex UI.

FlexMonkium is one of the tools we can integrate with Selenium IDE. In this document we are going to see how FlexMonkium is integrated with Selenium IDE.

Page 3: FlexUI Automation

Steps to be followed for integrating FlexMonkium with Selenium IDE:

1. Install Selenium IDE latest version from http://seleniumhq.org/download/ If the Selenium IDE window appears, you can just close it. (You will see Selenium IDE opened which does NOT have the Black FlexMonkium Icon on top right corner below the URL.)

For Selenium IDE detailed document go to this link.

http://seleniumhq.org/docs/02_selenium_ide.html

2. Install the FlexMonkiumConsole by running the FlexMonkium installer from http://www.gorillalogic.com/flexmonkium/downloads

Page 4: FlexUI Automation

For downloading the zip files and set up file you will need an account. I have created an account. You can use it. This account is just for downloading the required files. We will not use this account anymore after downloading the files.

Username: AvijitKalePassword: UCzQEy

Please make a note of where you install the executable because you will need to tell the Fire fox plug-in where it can find it (like c: //program files) When the installation completes, the FlexMonkiumConsole window will appear (a small application window with three buttons); you can close it for now.

3. Download and unzip the FlexMonkium zip file from http://www.gorillalogic.com/flexmonkium/downloads. It contains:

flexmonkium.xpi - The FlexMonkium Firefox extension installer. User-extensions.js - The FlexMonkium extensions for Selenium-RC.

4. Download automation_monkey.swc which suits to your Flex version (e.g.: 3.5, 3.4) from http://www.gorillalogic.com/flexmonkey/download .

5. Install the FlexMonkium Fire fox plug-in by opening flexmonkium.xpi in Fire fox.

6. Go to Selenium IDE from tools in fire fox window and there in Options options. Copy the path of the user-extensions.js (e.g.: C:\Documents and Settings\Admin\Desktop\Flex_Selenium\flexmonkium4.1.8\user-extensions.js) in the Selenium Core extensions.

Page 5: FlexUI Automation

7. Select a FlashBuilder (or FlexBuilder) project for which you want to enable FlexMonkium recording and playback.

8. Copy automation_monkey.swc to your project's libs folder. Use the swc that corresponds to your Flex version, for example, use automation_monkey4.x if you're using a Flex 4.x SDK.

9. Open the Project > Properties window in FlashBuilder.

10. Add libs/automation_monkey.swc to your Flex Build Path.

Page 6: FlexUI Automation

11. On the Flex Compiler panel, add the following Additional Compiler Arguments:

12. -includes-libraries libs/automation_monkey.swc

Be sure to use the name of the automation_monkey.swc that corresponds to your Flex SDK version. If for example you were using Flex 4.1, you would specify

-include-libraries libs/automation_monkey4.x.swc (whatever the file name which got stored in the place of automation_monkey4.x.swc).

Selenium IDE is launched from the Firefox Tools menu. If everything is installed properly, there will be a gorilla icon on the Selenium toolbar.

Page 7: FlexUI Automation

13. If everything works out fine. The selenium screen will show the black icon.

14. When you click on the FlexMonkium icon, the FlexMonkiumConsole should appear

Page 8: FlexUI Automation

If the console does not appear, select Options > FlexMonkium... from the Selenium menu, click on the Browse... button and navigate to where you installed the FlexMonkiumConsole executable. (As suppose we installed it in C://program files).

15. Simply open the Selenium-IDE window and turn on recording. In addition to the usual browser commands, Selenium will also record Flex commands from any Flex SWF which has been linked with the required libraries.

Each action recorded will create a waitForFlexMonkey command in Selenium-IDE.

16. Whenever a SWF loads, Selenium will record a waitForFlexMonkey command, which at playback time will pause the script until the SWF loads.

Playback works like usual Selenium playback.

Page 9: FlexUI Automation

When you record the test in selenium IDE with FlexMonkium, it shows up like this. Each Flex action recorded will create a waitForFlexMonkey command in Selenium-IDE.

Then you can play back the test by clicking on Play Current test case button on Selenium IDE or you can play the test case by clicking one by one on the instructions recorded.

I did the Fixture ON, OFF, Dim off through this. Every action on UI now is getting recorded on the selenium IDE.

You can view the script as well. Just go to OptionsFormatLanguage and it will show you the script for the test case in that language. Here is the screen shot for python script for the test case.

Page 10: FlexUI Automation

Go back to the original mode just select HTML in the language.

You can view the logs at the bottom of the Selenium IDE window.

Page 11: FlexUI Automation
Page 12: FlexUI Automation

Problem and Solution:

The only problem is when you play back the recorded test, it doesn’t select fixtures automatically. But if you select fixtures manually and execute the commands for ON, OFF or Dim off through selenium IDE, fixture behaves accordingly.

For the fixture selection problem here is the link.

http://www.gorillalogic.com/books/flexmonkium-docs/using-flexmonkium

in this, go to “Using the FlexMonkium Console”. This might help.