Using FlexUnit with Pure ActionScript

Now that I’m starting to develop non-trivial applications with ActionScript 3 I figured I should hop onto the test-driven-design bus and get down with FlexUnit. I’ve use JUnit in the past, and since it follows the xUnit style, I’ve had no problem getting used to FlexUnit… until I wanted to use it on a pure ActionScript project.

I had read on Darron Schall’s FlexUnit tutorial and other places that FlexUnit could be used on non-Flex projects, but I couldn’t find anyone who expanded on the concept to show how to do it.

It turns out it’s quite easy! Essentially all you have to do is to follow Darron’s excellent instructions and then take your main class and turn it into a separate application. To do this you just open the properties of your project (right click, select Properties) and then select Flex Applications from the list on the left. You then just click the Add button and specify the main class of your application. I usually make that the default application as well.

Now you have all of the niceties of FlexUnit without having to use Flex in your actual application. In our case this is very, very handy for making specialized, highly error prone code libraries.

no comments

  • No comments yet.