automated testing in flex
DESCRIPTION
automated testing in flexTRANSCRIPT
2005 Adobe Systems Incorporated. All Rights Reserved.1
Automated testing of Flex applications
Ram. K
Component Summit, SFO
22-June-2006
2005 Adobe Systems Incorporated. All Rights Reserved.2
Automated functional testing
GoalsAbility to automate the user level interactions on flex applications
Ability to verify that the application state is as expected before/after each interaction
WorkflowComponent developers develop “automatable” components
Application developers assemble “automatable” applications
QA engineers use a testing tool to automate the testing of the application
Unit testing and performance testing will not be covered in this session.
2005 Adobe Systems Incorporated. All Rights Reserved.3
Functional testing requirements
The tests should not be brittle Bit map comparison of screens is not an option!
Cosmetic changes in the application should not require recreation of automation scripts.
The failures should be easy to debug and reported in a clear cutand actionable way.
Test scripts should be easy to read and maintain.
2005 Adobe Systems Incorporated. All Rights Reserved.4
Flex Automated Testing
Automated Testing frameworkAn automation API for Flex component developers
Automatable components in the Flex SDK
Built in integration with Mercury Quick Test Pro.Record and play back interactions with Flex applications
Check points to verify the application state
Will be in beta when Flex 2 is released
2005 Adobe Systems Incorporated. All Rights Reserved.5
Flex AT Architecture
Testing tool APITesting tool API
Automation Component APIAutomation Component API
RecordRecord PlaybackPlayback HierarchyHierarchy IDID
Flex ComponentsFlex Components
Custom ComponentsCustom Components
InstrumentationInstrumentation
InstrumentationInstrumentation
QTP AdapterQTP Adapter Custom Adapters(future)
Custom Adapters(future)
Testing toolTesting tool
2005 Adobe Systems Incorporated. All Rights Reserved.6
Demo
2005 Adobe Systems Incorporated. All Rights Reserved.7
Flex AT concepts
IdentityNeed a persistent, human readable ID for every object in the application.
HierarchyNot all UI components are relevant, such as boxes
RecordRecord a single semantic event for an end-user gesture
Checkpoint creation
PlaybackReplay semantic events by simulating the original end-user gestures
Checkpoint verification
Testing vendorsAPI to support multiple testing vendors
2005 Adobe Systems Incorporated. All Rights Reserved.8
Application Developer Responsibilities
Human readable unique identifiers for each object in the appEg: Id property of a Panel inside a TabNavigator should be submit_panel rather than p1.
Understand default ID generation (e.g: Button label)
Fix AutomationName during objects life cycle (beta API)
Different labels for multiple tabs in accrodion, tabNav
Application to link in automated testing libraries.A testable application would be larger in size than a ‘regular’ app.
HTML wrapper with object id (Flex Builder does this automatically)
2005 Adobe Systems Incorporated. All Rights Reserved.9
Component Developer Responsibilities
Composite controlsMay be no changes! Demo
Components extending UIComponent (e.g slider)Define the contract with QTP
Identity of the new component
Operations exposed to QTP.
Properties to be verified
Exclude containers with no visible impact on the app
Reduce non interactive components such as boxes, spacers, rules
Hide “composited controls”
E.g: Button in a scrollbar or a slider thumb
Specify parent/child relationship when different from display hierarchy
E.g: Combo box
Add dispatch/playback of new interactions
2005 Adobe Systems Incorporated. All Rights Reserved.10
Verification
Many properties & styles are exposed for verificationExamples: visible, enabled, fillAlphas
Complex values are transcoded – arrays, colors, objects, selectedItems
ValueAn array of properties used to populate tabular data
Most components return an array of one - containers return an array of values
2005 Adobe Systems Incorporated. All Rights Reserved.11
Record & Playback
Record
Components are responsible for what/when to record
Record events signify high level user interactions
Recording information is put into an Event
Playback
Components are responsible for replaying their recordings by simulating the replay with low-level events
Components add synchronization callbacks Eg: ComboBox open/close, DragManager drag