Do you remember the cute Sesame Street skit about the child that needs to go to the store for a gallon of milk, a loaf of bread, and a stick of butter... how along the way the requirements got crazy and in the end the little boy reconciled his implementation using FlexUnit. Yeah... that one.
Unit testing frameworks can be very helpful at keeping products rolling out the door - and with fewer defects. If you've felt a little overwhelmed with all the different approaches / frameworks or the amount of work it takes to keep things up-to-date. The cure to what ails you might be a move to Flash Builder 4.
Flash Builder 4 is a fresh look forward that maintains respectful ties to its version 3 roots and adds some great debugging features. That is to say, that you can retire your reservations about unit testing, get friendly with FlexUnit, and experience the sweetness of Flash Builder 4... without giving up the Flex 3.x SDK.
I'm assuming that you've downloaded and installed FB and are ready to go... start by creating a new project and in the dialog - make sure to specify the Flex 3.4 framework under Flex SDK Version.
In my project, I've created a class called Foo with a single method to add a series of numbers. After creating the class, right click on the project and add a new test case.
In the New TestCase Class dialog... give it a name and identify the class to test. We'll be testing the Foo class.
Click next...
Check the add method... and then click finish.
In Flash Builders project navigator (on the left) double click on the newly created FooTest.as file.
Notice that in your generated unit test there is now a testAdd() method...
I've added a simple assertion - that 2 + 2 = 4.
public function testAdd():void
{
classToTestRef = new Foo();
Assert.assertEquals( classToTestRef.add( 2, 2 ), 4 );
}
Right click on FooTest.as and select the Execute FlexUnit Tests.
This will pop-up a Launching FlexUnit Application dialog... and VOICI!
The results fruit of your labor.