Nov 28, 2009

The Woes of FlexUnit testing

Ant's flexunit task does not run with a native FlexUnit testrunner component. You need to ensure you use the JUnitTestRunner component with task of Ant.

(I learnt it the hardway though :))

import flexunit.junit.JUnitTestRunner;
import flexunit.framework.TestSuite;
private var jUnitTestRunner:JUnitTestRunner;

private function onInit():void{
status.text = "Unit tests running";
jUnitTestRunner = new JUnitTestRunner();
jUnitTestRunner.run(suite(),onAllTestsCompleted);
}
public static function suite():TestSuite{
var _testSuite:TestSuite = new TestSuite;
_testSuite.addTestSuite(MyTestCases);
return _testSuite;
}
private function onAllTestsCompleted():void{
fscommand("quit","");
}

This makes me wonder, why is it named as Shouldn't it be ?

No comments: