O'Reilly logo

Flex 3 Cookbook by Joshua Noble, Todd Anderson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 24. Unit Testing with FlexUnit

Unit testing is a practice and concept that has been slowly gaining in popularity and acceptance in the Flex community as Flex applications have grown larger and more complex. Unit testing, the process of ensuring that new additions or changes to a project do not introduce bugs or modify expected behavior, enables large teams to work in tandem without introducing bugs and confirm that small individual parts of a program, down to specific methods, all return the expected results. This lets bugs and errors be pinpointed much more quickly, because a properly written unit test will test the behavior of a single method or a very small piece of functionality.

The core of unit testing is the test case, an evaluation that passes a value into a method of an application and reports the test as passing if the correct value is returned. These can be as simple as checking whether a method returns the correct integer value for an operation or as complex as ensuring that some display logic is appropriately performed or that a service has returned the correct object type. Many test cases taken together are referred to as a test suite, a group of test cases that can test an entire application or a specific aspect of a very large application. The test suite will show all test cases that have passed or failed. As a developer adds new code to the application, new test cases are written to provide coverage for that new code and are added to the test suite, and then ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required