Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Testing Flex RIAs for NJ Flex user group

920 views

Published on

Why to test?
● Automation testing and tools overview
● Flex Automation 101
○ Flex Automation Framework building blocks ○ How to prepare you components for
automation testing
● Using FlexMonkey for testing custom
components

Published in: Technology
  • Hi there! Get Your Professional Job-Winning Resume Here - Check our website! http://bit.ly/resumpro
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Be the first to like this

Testing Flex RIAs for NJ Flex user group

  1. 1. Testing Flex RIAs Viktor Gamov, Farata Systems April, 27 2011
  2. 2. Agenda• Why to test?• Automation testing and tools overview• Flex Automation 101 • Flex Automation Framework building blocks • How to prepare you components for automation testing• Using FlexMonkey for testing custom components
  3. 3. Why to test?
  4. 4. Software Has Bugs• We want to minimize the number, and• We want change to safe• How?
  5. 5. Only person who can write code without bugs is ...
  6. 6. Only person who can write code without bugs is ...
  7. 7. Why Chuck Norris does not test?
  8. 8. Why Chuck Norris does not test?• His code is perfect
  9. 9. Why Chuck Norris does not test?• His code is perfect• He does not need code documentation and communication on the project
  10. 10. Why Chuck Norris does not test?• His code is perfect• He does not need code documentation and communication on the project• Perfect memory
  11. 11. Why Chuck Norris does not test?• His code is perfect• He does not need code documentation and communication on the project• Perfect memory• Refactoring without problems
  12. 12. Testing Flex RIAs
  13. 13. Testing Flex RIAs• Unit testing
  14. 14. Testing Flex RIAs• Unit testing• Functional (UAT, QA)testing
  15. 15. Testing Flex RIAs• Unit testing• Functional (UAT, QA)testing• Integration testing
  16. 16. Testing Flex RIAs• Unit testing• Functional (UAT, QA)testing• Integration testing• Load testing
  17. 17. Automation testingtools overview• QTP• Selenium• Ranorex• FlexMonkey
  18. 18. QTPPros:• All-in-one suite for automation testing enterprise applications• Supports large pool of  software development environments like SAP , Web , Oracle etc.• QTP is easier to use and implement for both technical & non technical testers• Support libraries out-of-the-box with Flex(qtp.swc, qtp_air.swc)
  19. 19. QTPCons:• Unstable work• Absence of IDE for debugging scripts• Only Windows and IE (sorry Mac and Linux• VBScript as scripting language• Not free and expensive
  20. 20. Selenium + Flex API• Web applications testing• Open source and large community• Cross platform (Selenium IDE - browser extension)• JavaScript as scripting language
  21. 21. Ranorex• Similar to QTP, but better• Support large amount supported technologies (.NET, WPF, Silverlight, Qt, Win32, Delphi, WFC, Java SWT, Web testing, Flash/Flex testing) and platforms• Script languages C#,VB.NET, IronPython• Integration with Visual Studio 2010• Platform: Windows• Not free, ~$1590 for one license (full suite)
  22. 22. FlexMonkey• OpenSource (commercial support available)• Flex apps testing centric tool• Cross platform (console - AIR application )• Generated FlexUnit 4 test code• Supports testing only Flex applications (no Flash)• Integration with Selenium IDE (FlexMonkium project)
  23. 23. The process of creating a customcomponent that supports automatedtesting is called instrumentation
  24. 24. Flex Automation 101
  25. 25. Component delegate• instance of delegate class gets added for each instance of components• delegates know about the component which associated• adds listeners to interested events of component• decides what to do when an event occurs and calls appropriate method on Automation Manager• can provide additional methods which will be interested for testers
  26. 26. Automation Flow Core Flex API SystemManager Automation Delegates Automation API Automation Manager Delegates Delegates QTP FlexMonkey Selenium Agent Classes Agent Agent Agent Automation Tools QTP FlexMonkey Selenium
  27. 27. Flex AutomationFramework building blocks• Component delegate (automation.swc, automation_dmv.swc ...., custom classes )• Automation Manager (automation_manager.swc)• Tool Adapter (automation_monkey4.x.swc)• Testing Tool (FlexMonkey Console)• Environment configuration
  28. 28. [Mixin] metadata tag• use is to create static code blocks to initialize parts of your application• that static code will be executed when a preloader finishes loading of the application class and the SystemManager is ready to kick off [2 frame]
  29. 29. [Mixin] exampleimport mx.managers.ISystemManager;//---------------------------------------------------// Example//---------------------------------------------------[Mixin]public class MyMixin{ /** * called due to the fact that ive used the [Mixin] metatag * @param systemManager */ public static function init(systemManager:ISystemManager):void { // do something }}
  30. 30. How to prepare your components for automation testing
  31. 31. What is a custom component• A component extending from a standard component (No additional events, no additional properties)• A component extending from a standard component – Additional events/ additional properties• A component extending from a non container class, but the current class is a container.
  32. 32. What to do in delegate if component extending from standard component• Nothing! Use delegate classes shipped with Flex Framework
  33. 33. What to do in delegateif component extending from standard component + additional events or properties• Add Event listener to interesting event• Identify the details of the event which is needed to reply the event later• Pass event to record to automation manager• handle reply of the event
  34. 34. What do in delegatecomponent extending from non container class, but the current class need to be threaded as a container • Expose required children • getAutomationChildren • getAutomationChildAt • get numAutomationChildren • Provide the child handler methods • createAutomaitonIDPart • resolveAutomationIDPart • createAutomationIDPartWithRequiredProperties
  35. 35. Using FlexMonkey for testing custom components Demo
  36. 36. Conclusion• Testing is a very powerful tool to help produce, maintain and impart confidence in your software• Actionscript 3 now has testing tools approaching the level available to Java developers• We should all be testing!
  37. 37. Resources• Enterprise Development with Flex, O’reilly, 2010• GorillaLogic http://clck.ru/BXV4• Ranorex Flex Testing http://clck.ru/BXUk• Automation Docs http://clck.ru/Bqbn• Blog on Flex Automation http://clck.ru/BqbU
  38. 38. Thank you!Contact me!

×