Hey Vinoth,

While AsUnit does work with Flex applications, it really shines for
ActionScript-only applications because you don't need to compile on
top of the Flex framework in order to execute your test harness.

You should be able to use the ActionScript 3 build of the AsUnit
framework found in the following link (http://www.asunit.org/#getStarted).

The following code should be placed in a file named
'SomeProjectRunner.as' and added to your class path. This class can be
set up as an 'application' in Flex Builder, and compiled and run to
see your test results.

-------------8<--------------

package {
  import asunit.textui.TestRunner;
  
  public class SomeProjectRunner extends TestRunner {

    public function SomeProjectRunner() {
      // start(clazz:Class, methodName:String, showTrace:Boolean)
      // NOTE: sending a particular class and method name will
      // execute setUp(), the method and NOT tearDown.
      // This allows you to get visual confirmation while developing
      // visual entities
      start(AllTests, null, TestRunner.SHOW_TRACE);
    }
  }
}

------------->8--------------

Usually, we create a class that sits in the root of our test directory
named 'AllTests', and this is a test suite that collects all of our
test cases for easier reference.

If you're interested in test-driven development for ActionScript or
Flex projects, you might want to check out Sprouts
(http://www.projectsprouts.org). This is a tool set that should get
you some example projects up and running very quickly. Even if you're
not interested in the tool itself, you might benefit from seeing how
the projects are structured.

Another helpful tool is the XUL UI found at the AsUnit link above.
This is a simple desktop GUI application that will auto-generate
classes, test cases and test suites for ActionScript 2, 3 or Flex
applications.

Please feel free to check in on the AsUnit mailing list if you have
more questions!

https://lists.sourceforge.net/lists/listinfo/asunit-users


Thanks!


Luke Bayes
http://www.asunit.org


Reply via email to