The demand for testing Flash/Flex applications has become much more significant during the last few years. This indicates widening usage of this technology, which in turn illustrates a need for automated testing of these applications. However, this need raises a few questions and problems, some of which will be discussed in the following article.
Specifically, the first question that must be answered about automating a Flash/Flex application is: which is the right automation technique? There are two distinct ways to go:
Native mouse & keyboard integration – good for situations where there is minimal Flash interaction required.
API-level integration – good for situations where there is a lot of Flash interaction required.
Native mouse & keyboard integration – This is where a mouse movement, mouse click, or keyboard action is simulated at the operating system level. It reproduces the most realistic user simulation by recording GUI-based actions, getting us very close to “real life” use of our application. However, using this method has some problems. For example, testing a Flash application requires that the application and the testing environment be prepared in a special way. There are different ways to make your Flash application testable, depending on the testing tool used and development environment. Some tools such as TestComplete, Rational Robot, and QTP require that a dedicated library (usually supplied by the tool’s vendor) be embedded in the Flash application during compilation or at run time. Specifics of this process can typically be found within the documentation of these tools.
Capturing the objects in a Flex/Flash application is problematic on its own. To solve this, there are two main approaches:
API-level integration – For applications that have much more complex Flash/Flex user interfaces or applications that are 100% Flash-based, it is hard to use GUI capturing as presented since it can be brittle and difficult to confirm that the desired functionality worked. For this, one can use the API level integration. To do this type of automation one must be able to recompile/modify the underlying Flash object(s).
How you proceed from here depends on whether you are using Flash or Flex, as Flex exposes some automation APIs that will, otherwise, have to be reproduced if you are using pure Flash. To do this one can: