FlexUnit
I typed “flex unit test” into google, and came up with a couple results. This tutorial got me started with FlexUnit even though it covers FlexBuilder 2. Basically, you add the flexunit.swc file to your library (like a jar?) and you’re good to go. You cut and paste a testrunner.mxml GUI to call your test suites, which are somehow found automatically (by virtue of being in the same directory?)
var ts:TestSuite = new TestSuite();
ts.addTest( TemperatureConverterTest.suite() );
There are a few of warnings:
return value for function ‘onCreationComplete’ has no type declaration — on ExampleTestRunner.mxml
and:
duplicate variable definition — on TemperatureConverterTest.as
but no real problems.
The syntax is enough like Junit to not warrant any comment, though again, I’m sure I’ll notice details once I delve in. An interesting project would be to port (or look for) a TestNG [link] style framework with dependencies, but that’s overkill at this point.
I’ll look for a couple more tutorials. I remember seeing one before reading this that talked about a new way to run tests. Already, I want to be able to run tests without the GUI runner. Another project would be an eclipse plugin that can run FlexUnit similar to Junit tests.