AUTOMATED UI TESTER FOR ADOBE® ACTIONSCRIPT®
USER GUIDE
Last Updated 30 May 2012 t
Adobe Systems Inc.
___________________________________________________________
《Automated UI Tester》中文翻译——水桥月
Contents
Introduction ............................................................................................................................................................................................ 3
How to set up Genie ........................................................................................................................................................................... 3
Ensuring that Genie has been set up successfully ....................................................................................................................................... 4
Various components of Genie ......................................................................................................................................................... 5
GenieID ..................................................................................................................................................................................................... 5
Genie Features Overview ................................................................................................................................................................... 5
Detailed Description of Features .................................................................................................................................................... 6
Genie user interface ................................................................................................................................................................................................. 6
Genie menu ............................................................................................................................................................................................................ 6
Connect to SWF drop-down menu ................................................................................................................................................................ 7
Working with Genie View ................................................................................................................................................................................. 7
Genie context menu .......................................................................................................................................................................................... 12
Different Genie status icons ................................................................................................................................................................................ 14
Script recording and playback ........................................................................................................................................................................... 14
Set up a script project ....................................................................................................................................................................................... 14
Script recording in Genie ................................................................................................................................................................................. 15
Script playback using Genie ........................................................................................................................................................................... 16
Genie Test Suite ....................................................................................................................................................................................................... 18
Recording SWF Applications ..........................................................................................................................................................19
Recording mouse actions .................................................................................................................................................................................... 19
Click action is performed but nothing happens ..................................................................................................................................... 19
Recording keyboard actions ............................................................................................................................................................................... 19
Command-line usage of Executor ............................................................................................................................................................... 20
Accessing command-line parameters passed to the Genie script ................................................................................................... 21
Running Genie steps without extending the Java class from your Genie script ........................................................................... 21
User-exposed methods for validation and generic use .......................................................................................................................... 22
Generic component methods ........................................................................................................................................................................ 22
Automatic Synchronization ............................................................................................................................................................................ 23
Specific Component Methods ........................................................................................................................................................................ 23
Script Methods ..................................................................................................................................................................................................... 24
Genie Helper class ............................................................................................................................................................................................. 24
Global variables in scripts ............................................................................................................................................................................... 25
UI Functions ............................................................................................................................................................................................................... 26
Usage of UI functions ....................................................................................................................................................................................... 27
Logging ....................................................................................................................................................................................................................... 28
Script logs .............................................................................................................................................................................................................. 28
Disabling script logging ................................................................................................................................................................................... 29
Adding custom steps in a script log ............................................................................................................................................................ 29
Assertion steps in a Genie script ................................................................................................................................................................... 30
Multi-SWF recording and playback ................................................................................................................................................................. 30
Extending GenieID at run time .......................................................................................................................................................................... 30
Genie Locator ............................................................................................................................................................................................................ 31
Capturing Flash events for validation ............................................................................................................................................................. 33
Image-based validations ...................................................................................................................................................................................... 33
Component image shown is not the correct component image ...................................................................................................... 34
UIImage.findImage method fails to find the image .............................................................................................................................. 34
Dispatching events on a covering layer ......................................................................................................................................................... 34
Special usage scenario for getValueOfDisplayObject() ........................................................................................................................... 35
Support for a SWF application having non-English characters ........................................................................................................... 35
Java Documentation for Genie ......................................................................................................................................................36 Automated UI Tester for Adobe® ActionScript®
3
Introduction
Automated UI Tester for Adobe® ActionScript® is code named as Genie.
Automated UI Tester is a Flash/Flex automation tool that can record user actions on a SWF file and play them back with high fidelity. With other automation tools, automating Flash applications requires instrumenting them to run inside a wrapper application; but with Genie, it just requires a configuration file and Flash Player. So with Genie, users can automate their production builds easily. Genie currently works on Windows and on Mac OS X.
How to set up Genie
Follow these steps to set up the Genie environment. You can run Genie with a debug version of Flash Player:
1. Install the debug version of Flash Player (depending on your testing needs) from: http://www.adobe.com/support/flashplayer/downloads.html Install the appropriate version of Flash Player for your operating system and web browser.
2. JDK version 1.5 is required (Recommended is JDK 1.5 Release 22) for compiling recorded Genie scripts and your other Java development needs. (You just require JRE in case you already have compiled Script classes.) The JDK can be downloaded from:
http://www.oracle.com/technetwork/java/javasebusiness/downloads/java-archive-downloads-javase5-419410.html
3. Install the Eclipse IDE for Java Developers, version 3.5.0 or above, for writing scripts. The latest version of Eclipse can be downloaded from:
http://www.eclipse.org/downloads/
4. Get the latest build of Genie.zip provided to you; copy the ZIP file to any location on your disk and extract it.
Note: In subsequent pages, <GeniePath> will refer to the location where you have unzipped the Genie.zip file.
5. Copy GeniePlugin.jar from <GeniePath>\GeniePlugin\GeniePlugin.jar to the plug-in folder of your Eclipse installation folder. For example: D:\Eclipse\Plugins
6. Copy the mm.cfg file from <GeniePath>\GenieLibrary\mm.cfg to the user folder. o C:\Documents and Settings\testuser\ (For Windows XP)
o C:\Users\testuser\ (For Windows 7)
o /Users/testuser/ (For Mac Os X)
7. Open mm.cfg and edit it to update the path to the file GenieLibrary.swf. You just need to add one line in mm.cfg, which will look like:
PreloadSWF = <GeniePath>\GenieLibrary\GenieLibrary.swf
8. Open the “Global Security Settings panel” topic in Flash Player Help: http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.ht