Saturday, 20 December 2008

FlexUnit revisited

On my current project, I have been working with FlexUnit and discovered that it will locate test methods in a class based on their name starting with test. I am using FlexUnit 0.85 since that is currently in the repository used by the Flex mojos.

In all the examples for Flex Unit, they show the use of a method that adds individual test methods to a test suite using 'addTest(new TestClass(“testName”).' This method to build the suite is usually placed in the test class (TestClass). In looking at trying to build a tree of test suites, I looked at addTestSuite method. Reading the documentation at the front of the class, it talks of adding a test class by using new TestSuite( TestClass ). This approach adds the test class as a suite by locating all methods that have names starting with test. This reduces the coding overhead and makes it easier to use.

FlexUnit 0.85 doesn't seem to report the suites in a tree hierarchy. This is rather frustrating as the number of tests grow. Flex Unit 0.90 does correct this but still lacks the use of attributes for identifying tests and some of the other features now in JUnit for Java and NUnit for .NET.

No comments: