« Nothing to Be Frightened Of | Main | Child 44 »

Flex Automation Framework (BFUG Jan 2009)

Eric Hilfer from Tom Synder Productions is speaking about Flex Automation Framework and automated testing.

Automation Framework: records and playbacks UI events (mouse and keyboard), identifies controls by context to make them less brittle, can read object properties, delegate objects separate automation logic from core component (allows runtime and compile time inclusion).

How it works: Flex includes SWC libraries, compiled as [Mixin] (during compilation the code gets pulled in), Agent then interacts with AutomationManager (can be 3rd party), testing tool communicates with Agent, tests, suites, etc. QA uses tool developer has to expose to Agent.

Good: Smart UI element identification, decouple automation from code, no bloat.
Bad: Not fully AIR-aware (no good support for multiple top-level windows), assumes everything is a UIComponent.
Can programtically detect presence of AutomationManager and behave differently, but not recommended.

Using it: HP QuickTest Pro (expensive, must run in IE browser), RIATest (inexpensive agent) (will be demoing), build your own. Flex Monkey is another alternative.

When you compile your project, include all of the automation SWCs. Alternative is if your application can be loaded just as a SWF, load it into a wrapper that has the automation libraries.

Anything derived from UIComponent will just work. For custom extensions, register with an XML file. Automation name, real classname, events to watch, properties to expose. Delegates register themselves with the AutomationManager for which class they handle.

Making automation easier: Give each button a unique name so that automation can find it even if it is moved. Don't use UIDs.

RIATest demo. Can be run interactively to record tests and setup verifications. Windows native application but can have instances running on other machines reporting to it. Has command line run mode. Scripts supports loops, limited external data file reading.

Customization of "get automationName()". Names can be context unique, doesn't need to be application unique. Need to wrap custom events with automation events (should be placed in delegate object). Need special handling for native window.

XRay Tool very useful for debugging.

Tags: automation flex testing ui

Comments

Daniel, it's nice to see someone else using QTP AND Flex!! We recently implemented QTP 9.5 and Flex 3 components to regression test our Flex/PHP application. The initial challenge was to get QTP to recognize and record on Flex objects. After figuring this out, I documented an Installation doc that specifies the sequence of installation of the various components required to record and play on a complex Flex app. Thanks for your tips and insight! If you need any help with either QTP or photography, feel free to contact me. Regards, Steve
"Not fully AIR-aware (no good support for multiple top-level windows), assumes everything is a UIComponent." Adobe has officially supported AIR automation only from Flex4 and in Flex4 multiwindow support is available. Automation framework does not expect the compoentnes to be UIComponent. Rather it expects some of the API's part of IUIComponent and IAutomationObject. Any component can be automation enabled by ensuring the availability of certain API's. Please let us know your thoughts and improvement suggestions. To discuss more about Flex Automation framework visit http://raniskumar.wordpress.com
Take a look at http://bitbucket.org/loomis/uinput/wiki/Home. It allows simulating user input via automation framework. Can be easily used with unit tests or any other test driver. It also plays nicely with morefluent library for verification. An example use with a givwenzen automated acceptance criteria verification framework: http://bitbucket.org/loomis/givwenzen-flex/wiki//UITesting Regards, Kris