Recently FlexUnit 4 beta 1 was released. To get started I recommend FlexUnit 4 in 360 seconds and the feature overview. If you are using the Swiz framework and want to apply some changes to provide a patch file you could run the unit tests to be sure to break no features.
This is quite easy to do with the following steps:
- Create a new Flex AIR project: SwizTestRunner
- Download latest FlexUnit 4 and copy the SWCs into the SwizTestRunner libs directory
- Add the Swiz test class path: /../Swiz/src/test/flex
- Add your compiled Swiz.swc as a library
- Copy-n-paste the following into the SwizTestRunner.mxml
<?xml version="1.0" encoding="utf-8"?> <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" applicationComplete="applicationCompleteHandler()" width="1200" height="640" xmlns:flexUnitUIRunner="http://www.adobe.com/2009/flexUnitUIRunner"> <mx:Script> <![CDATA[ import org.swizframework.service.ServiceTestSuite; import org.swizframework.autowire.AutowireTestSuite; import org.swizframework.factory.FactoryTestSuite; import org.swizframework.util.ExpressionTestSuite; import org.flexunit.listeners.UIListener; import org.flexunit.runner.FlexUnitCore; private var core:FlexUnitCore; private function applicationCompleteHandler():void { core = new FlexUnitCore(); core.addListener(new UIListener(uiListener)); core.run(AutowireTestSuite, ServiceTestSuite, ExpressionTestSuite, FactoryTestSuite); move(50, 50); } ]]> </mx:Script> <mx:TraceTarget fieldSeparator="->" includeCategory="true" includeTime="true" includeLevel="true" /> <flexUnitUIRunner:TestRunnerBase id="uiListener" width="100%" height="100%" /> </mx:WindowedApplication> |
Now you can run the application and you should see the unit tests being executed:
To get started just have a look at the Swiz unit tests we have build so far. FlexUnit 4 is metadata driven so you should feel home when you use Swiz. We are continually extending our unit test suites but if you find a bug and can prove it with a failed test case you have provided this would be pretty awesome!