8.1. Testing

Testing Flex and BlazeDS applications involves testing applications both sides of the wire and also testing the connector in the middle. Flex and Java support unit testing frameworks that can automate and streamline the testing activity.

JUnit (http://junit.sourceforge.net/), which belongs to the xUnit testing framework family, provides an easy way to implement repeatable unit tests in Java. JUnit is not the only unit testing framework for Java. Alternatives like TestNG (http://testng.org/) exist. This chapter uses JUnit 4.7 to illustrate Java code testing strategies and methodology.

Like JUnit, FlexUnit (http://opensource.adobe.com/wiki/display/flexunit/FlexUnit) provides a way to implement repeatable tests for Flex and AS3 applications. The latest version, FlexUnit 4, is a major improvement over its original FlexUnit 1.0 release. The testing idioms used in FlexUnit and JUnit are similar.

To explain testing strategies and the necessary tools, I first fork the discussion along two independent lines, following JUnit and FlexUnit, respectively. Once I explain each of these individually, I merge the discussion to consider testing client- and server-side technologies together. I will start with FlexUnit.

8.1.1. FlexUnit

FlexUnit 1.0 is the current stable release. FlexUnit 4 beta was launched in May 2009 and will be the next release candidate. FlexUnit has evolved and changed substantially from version 1.0 to version 4, so it is prudent to understand both the versions. ...

Get Professional BlazeDS: Creating Rich Internet Applications with Flex® and Java® now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.