FlexUnit: What’s new?

This new release of FlexUnit came along with additional features in both the FlexUnit API and the user interface.
Those new features have been created to simplify your daily testing.

As promised, here is the change list made for this release:


This new release of FlexUnit came along with additional features in both the FlexUnit API and the user interface.
Those new features have been created to simplify your daily testing.

As promised, here is the change list made for this release:
- The EventfulTestCase described here has been added to FlexUnit. The API of this extension has been changed. More to come about this soon.

- Assert.assertEquals( NaN, NaN ) doesn’t fail anymore: assertEquals now uses isNaN when the expected value is NaN.

- Assert.assertMatch has been added :

/**
 * Asserts that a string matches a regexp.
 * The first argument can be the message when the assertion fails
 *
 * @param rest [ message = "", regexp, stringToTest ]
 *
 */
 public static function assertMatch( ... rest ) : void {}

- Assert.assertNoMatch has been added :

/**
 * Asserts that a string doesn't match a regexp.
 * The first argument can be the message when the assertion fails
 *
 * @param rest [ message = "", regexp, stringToTest ]
 *
 */
 public static function assertNoMatch ( ... rest ) : void {}

- Assert.assertContained has been added :

/**
 * Asserts that the first string is contained in the second one
 * The first argument can be the message when the assertion fails
 *
 * @param rest [ message = "", shortString, longString ]
 *
 */
 public static function assertContained( ... rest ) : void {}

- Assert.assertNotContained has been added :

/**
 * Asserts that the first string is not contained in the second one
 * The first argument can be the message when the assertion fails
 *
 * @param rest [ message = "", shortString, longString ]
 *
 */
 public static function assertNotContained ( ... rest ) : void {}

From a UI perspective, beside the new design, here are the neat features which have been added:

- Event if you can still the TestRunnerBase component, it is recommended to use the new FlexUnitTestRunnerApplication in order to have all the styles. Here is how the main application component will look like:

<?xml version="1.0"
xmlns:mx="http://www.adobe.com/2006/mxml"  encoding="utf-8"?>
<FlexUnitTestRunnerApplication
xmlns="*"
testSuite="{ new AllTests() }">
<mx:Script>
<![CDATA[
                  import test.AllTests;
            ]]>
</mx:Script>
</FlexUnitTestRunnerApplication>

- A completeEvent is now dispatched when the entire test suite has run. This event is dispatched by FlexUnitTestRunnerApplication and by TestRunnerBase

- The number of assertions made during a test and during the test suite is stored. You can filter test cases on this value.

- You can filter test cases on test case names, on expected values, on actual values, on results, or on number of assertions made during a test.

- The stacktrace is pretty printed to emphasis the calls which don’t come from a framework class : flexunit.* flash.* mx.*

- The last location is extracted from the stacktrace and displayed in the UI.

- The expected and actual values are displayed in the grid

From a portability point of view:
- You can use the flexunit.swc for both Flex 2 and Flex 3 projects

- You can launch the runner in 1024*768 resolution without scroll bar and cropped texts

If you have any feature requests on FlexUnit, please add it here.