开发者

Flex unit testing with ANT vs Flash Builder 4

I have just tried setup unit testing in Flash Bu开发者_StackOverflowilder 4, and it working nicely. A setup of a parallel test source structure and using Flash Builder 4:s new TestCase and new TestSuite I was up and running with some testcases within minutes.

But now I want to compile them from a ant flex task, the Flash Builder generates FlexUnitApplication.mxml and FlexUnitCompilerApplication.mxml. Is there a nice way to build the unit tests with ant using these? I cant find any sample where this is done.


We use for each of our test project a CITestRunner.mxml file which essentially contains the following code

<mx:Script>
    <![CDATA[           

        import mx.logging.LogEventLevel;

        import org.flexunit.internals.TextListener;
        import org.flexunit.listeners.CIListener;
        import org.flexunit.runner.FlexUnitCore;

        public function runTests():void
        {
            var core:FlexUnitCore = new FlexUnitCore();
            core.addListener( new CIListener( 40000 ) );
            core.addListener(TextListener.getDefaultTextListener(LogEventLevel.DEBUG));                 
            core.run( new FlexUnitApplication().currentRunTestSuite() );

        }

    ]]>
</mx:Script>

All you need to do is compile the application with this app as main class, and run it using the provided "flexUnit" ant task and you should be just fine.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜