Test Automation in Flex - Richa Sharma
-
Upload
indicthreads -
Category
Technology
-
view
1.922 -
download
2
description
Transcript of Test Automation in Flex - Richa Sharma
![Page 1: Test Automation in Flex - Richa Sharma](https://reader034.fdocuments.in/reader034/viewer/2022042623/54bd475a4a7959e35e8b4582/html5/thumbnails/1.jpg)
Test Automation In Flex
Richa Sharma
SAS Research And Development (India)
![Page 2: Test Automation in Flex - Richa Sharma](https://reader034.fdocuments.in/reader034/viewer/2022042623/54bd475a4a7959e35e8b4582/html5/thumbnails/2.jpg)
Agenda
• Automate It!• The Flex Automation Feature• Prepare to Automate• Automated Testing Workflow• Instrumentation• FlexMonkey – A dekko• Summary• Q&A
![Page 3: Test Automation in Flex - Richa Sharma](https://reader034.fdocuments.in/reader034/viewer/2022042623/54bd475a4a7959e35e8b4582/html5/thumbnails/3.jpg)
Flex Overview
![Page 4: Test Automation in Flex - Richa Sharma](https://reader034.fdocuments.in/reader034/viewer/2022042623/54bd475a4a7959e35e8b4582/html5/thumbnails/4.jpg)
Automate It!
• Flex provides an automation feature which makes Flex applications automation enabled.
• Flex Automation APIs aid in creating custom agents or ensuring the readiness of Flex applications for testing.
• Flex also provides support for the automation tool – QTP.
![Page 5: Test Automation in Flex - Richa Sharma](https://reader034.fdocuments.in/reader034/viewer/2022042623/54bd475a4a7959e35e8b4582/html5/thumbnails/5.jpg)
The Flex Automation Feature
• Automation libraries• QTP files• Samples
![Page 6: Test Automation in Flex - Richa Sharma](https://reader034.fdocuments.in/reader034/viewer/2022042623/54bd475a4a7959e35e8b4582/html5/thumbnails/6.jpg)
The Automation Libraries
• Automation libraries – delegate implementations for Flex framework components• automation.swc• automation_agent.swc – generic agent mechanism• automation_dmv.swc – delegates for charting and
Advanced DataGrid components
![Page 7: Test Automation in Flex - Richa Sharma](https://reader034.fdocuments.in/reader034/viewer/2022042623/54bd475a4a7959e35e8b4582/html5/thumbnails/7.jpg)
Prepare to Automate• Prepare the application:
• Use automation at runtime• Use automation at compile-time (Make your own
testable application)
• Prepare customized components for testing• Deploy the application
![Page 8: Test Automation in Flex - Richa Sharma](https://reader034.fdocuments.in/reader034/viewer/2022042623/54bd475a4a7959e35e8b4582/html5/thumbnails/8.jpg)
Prepare to Automate - Runtime
• Automation at runtime• Wrapper SWF file compiled with automation
libraries• The SWF uses SWFLoader to load the
application SWF
![Page 9: Test Automation in Flex - Richa Sharma](https://reader034.fdocuments.in/reader034/viewer/2022042623/54bd475a4a7959e35e8b4582/html5/thumbnails/9.jpg)
Prepare to Automate – Compile time
• Make your own testable application• Compile the application with the automation
libraries• Requires access to Flex application• Embedding of functional testing classes
increases the size of the SWF
![Page 10: Test Automation in Flex - Richa Sharma](https://reader034.fdocuments.in/reader034/viewer/2022042623/54bd475a4a7959e35e8b4582/html5/thumbnails/10.jpg)
Prepare to Automate
• Points to remember while developing:• All testable controls should have ids• Unique ids• Containers can be excluded from being tested
if not impacting the test• UIComponent class – showInAutomationHierarchy
• Can be avoided:• Same labels for multiview containers like
TabNavigator• Dynamically adding children
![Page 11: Test Automation in Flex - Richa Sharma](https://reader034.fdocuments.in/reader034/viewer/2022042623/54bd475a4a7959e35e8b4582/html5/thumbnails/11.jpg)
Prepare to Automate
• Points to remember while testing:• If automation is used at compile-time
• Look out for inflated SWF files• Remove references of automation libraries from
SWF before deploying on production server
![Page 12: Test Automation in Flex - Richa Sharma](https://reader034.fdocuments.in/reader034/viewer/2022042623/54bd475a4a7959e35e8b4582/html5/thumbnails/12.jpg)
Automated Testing Workflow
• Initialization• Recording• Playback
![Page 13: Test Automation in Flex - Richa Sharma](https://reader034.fdocuments.in/reader034/viewer/2022042623/54bd475a4a7959e35e8b4582/html5/thumbnails/13.jpg)
Automation Workflow – Initialization
![Page 14: Test Automation in Flex - Richa Sharma](https://reader034.fdocuments.in/reader034/viewer/2022042623/54bd475a4a7959e35e8b4582/html5/thumbnails/14.jpg)
Automation Workflow – Recording
![Page 15: Test Automation in Flex - Richa Sharma](https://reader034.fdocuments.in/reader034/viewer/2022042623/54bd475a4a7959e35e8b4582/html5/thumbnails/15.jpg)
Automation Workflow – Playback
![Page 16: Test Automation in Flex - Richa Sharma](https://reader034.fdocuments.in/reader034/viewer/2022042623/54bd475a4a7959e35e8b4582/html5/thumbnails/16.jpg)
Instrumentation• Required for custom components or events
• Enables custom components or events to be testable
![Page 17: Test Automation in Flex - Richa Sharma](https://reader034.fdocuments.in/reader034/viewer/2022042623/54bd475a4a7959e35e8b4582/html5/thumbnails/17.jpg)
Instrumentation
• Requirements for instrumentation of a custom component:
•Delegate class•Appropriate entry in the class definition file
![Page 18: Test Automation in Flex - Richa Sharma](https://reader034.fdocuments.in/reader034/viewer/2022042623/54bd475a4a7959e35e8b4582/html5/thumbnails/18.jpg)
Instrumentation – The Delegate• For instrumentation of a custom component with
a delegate:• Create a delegate that
• is a mixin• implements the required interfaces
• Register the delegate with AutomationManager
• Define the component in the class definitions xml
![Page 19: Test Automation in Flex - Richa Sharma](https://reader034.fdocuments.in/reader034/viewer/2022042623/54bd475a4a7959e35e8b4582/html5/thumbnails/19.jpg)
Instrumentation – The Class Definition File
• Information about all the instrumented Flex components
• Tells the automation agent:• What is the name of the component • What events can be recorded and played back• What are the testable properties
![Page 20: Test Automation in Flex - Richa Sharma](https://reader034.fdocuments.in/reader034/viewer/2022042623/54bd475a4a7959e35e8b4582/html5/thumbnails/20.jpg)
Instrumentation – The Class Definition File
Typical structure:
<TypeInformation>
<ClassInfo>
<Description/>
<Implementation/>
<TypeInfo><Operation/> ... </TypeInfo> <Properties><Property/> ... </Properties>
</ClassInfo>
</TypeInformation>
![Page 21: Test Automation in Flex - Richa Sharma](https://reader034.fdocuments.in/reader034/viewer/2022042623/54bd475a4a7959e35e8b4582/html5/thumbnails/21.jpg)
Instrumentation – Considerations• Composition – single/composite component
• Container Hierarchy – understanding the automation hierarchy
• Automation name – clear, unambiguous names for easy referencing
![Page 22: Test Automation in Flex - Richa Sharma](https://reader034.fdocuments.in/reader034/viewer/2022042623/54bd475a4a7959e35e8b4582/html5/thumbnails/22.jpg)
FlexMonkey – A dekko
• FlexMonkey is an Adobe AIR application used for testing Flex and AIR based applications.
• Records, plays back and verifies Flex UI interactions
• Generates ActionScript-based testing scripts that can be easily included within a continuous integration environment.
![Page 23: Test Automation in Flex - Richa Sharma](https://reader034.fdocuments.in/reader034/viewer/2022042623/54bd475a4a7959e35e8b4582/html5/thumbnails/23.jpg)
FlexMonkey – Demo
![Page 24: Test Automation in Flex - Richa Sharma](https://reader034.fdocuments.in/reader034/viewer/2022042623/54bd475a4a7959e35e8b4582/html5/thumbnails/24.jpg)
To summarize…• Flex applications can be automated using the
Flex Automation APIs• Applications can be prepared to use automation
at:• Run Time
• Compile Time • Custom components need instrumentation:
• Delegate• Entries in the class definition file
![Page 25: Test Automation in Flex - Richa Sharma](https://reader034.fdocuments.in/reader034/viewer/2022042623/54bd475a4a7959e35e8b4582/html5/thumbnails/25.jpg)
Learnings• Components need a unique id• Containers not affecting the test can be avoided • Different labels are needed for multiple tabs in
TabNavigator, Accordian etc.• Component display hierarchy can be different
from Automation hierarchy
![Page 26: Test Automation in Flex - Richa Sharma](https://reader034.fdocuments.in/reader034/viewer/2022042623/54bd475a4a7959e35e8b4582/html5/thumbnails/26.jpg)
Latest on Flex AutomationNew in FlashBuilder 4 automation:• Automation of Flex 4 AIR applications
• Automation of Flex 4 applications• mx.core.Application, Halo – supported
• Spark based applications – not supported
• Automation of Marshalled Flex and AIR applications
![Page 27: Test Automation in Flex - Richa Sharma](https://reader034.fdocuments.in/reader034/viewer/2022042623/54bd475a4a7959e35e8b4582/html5/thumbnails/27.jpg)
References• http://livedocs.adobe.com/flex/3/html/help.html?content=functest_components2_02.html
• http://www.artima.com/articles/flex_spark.html • http://ranikumar.wordpress.com/category/flexautomation/ • http://opensource.adobe.com/wiki/display/flexsdk/Marshall+Plan
• http://www.gorillalogic.com/flexmonkey
![Page 28: Test Automation in Flex - Richa Sharma](https://reader034.fdocuments.in/reader034/viewer/2022042623/54bd475a4a7959e35e8b4582/html5/thumbnails/28.jpg)
Q&A