FlexUnit 4.1 Beta 2 Is Here

Today the FlexUnit 4.1 beta continues with the release of beta 2.

You can download the latest bits from the flexunit.org download site.

Beta 2 resolves a myriad of small bugs and adds minor features  including:

  • Fixed order of parameterized test versus order of data supplied
  • Added additional debug output during headless xvnc execution
  • Improved formatting of parameterized test names
  • Added a new interface IExternalDependencyData for simplified loading of external data during Parameterized Tests and Theories
  • Added comments and resolved many PMD warnings
  • Additional feedback with mis-configured Rules
  • Fixed BeforeClass and AfterClass duplicate execution with Parameterized Tests
  • Fixed a crash using Before and After with Parameterized runner
  • Updates to the sample CI project and build scripts to simplify builds without PMD
  • Updated Ant task to support Flex 3 and 4 for Flash and AIR

Improved External Data Loading for Parameterized Testing and Theories

One of the only API changes in FlexUnit 4.1 beta 2 from beta 1 is the addition of a new interface named IExternalDependencyData. With the addition of this interface, you now have two ways of getting external data into Parameterized Tests and Theories.

Option 1 is to use the IExternalDependencyLoader, which allows a separate class to load the dependency and then assign it to a static variable on the class when complete. This was available in FlexUnit 4.1 beta 1 and is still a great choice in a number of situations where you may have customer setters or other such functionality on the test.

public static var dataRetriever1:IExternalDependencyLoader = new ParamDataHelper( "PurelyFakeExample.xml" );
[Parameters(loader="dataRetriever1")]
public static var someData:Array;

public function TestParameterized( param1:int, param2:int ) {
_input = param1;
_expected = param2;
}

The IExternalDependencyLoader interface works with the Theory and Parameterized test runners to facilitate asynchronous loading of data points before testing begins.

Option 2 is IExternalDependencyData which extends IExternalDependencyLoader to simplify the syntax for the average case. It makes the test case more readable by eliminating the extra static variable which isn’t needed in most cases and allows the test to gather its data directly from the helper class. Here is an example of using this interface in a variety of situations.

[Parameters]
public static var dataRetriever:IExternalDependencyData = new ParamDataExt( "someFakeDataPath.stuff" );

public function TestParameterized( param1:int, param2:int ) {
_input = param1;
_expected = param2;
}

or

public static var dataTwo:IExternalDependencyData = new ParamDataExt( "someFakeDataPath.stuff" );

[Test(dataProvider="dataTwo")]
public function timesTwoTest( value:int, result:int ):void {
assertEquals( 2*value, result );
}

As you can see, the syntax really just eliminates the use of an extra static variable in most situations. The original interface is still available and supported but we suspect the IExternalDependencyData will be the right choice in most situations.

Now, get the latest bits from flexunit.org download site and give us some feedback.

9 Comments to “FlexUnit 4.1 Beta 2 Is Here”

  1. luchyx 24 June 2010 at 8:30 am #

    Cool !
    This version run smooth on CENTOS and Windows 2008 Server with HUDSON.

    Q: any chance to process description added with metadata [Test(description="bla bla")] with the ANT task?

    Cheers

  2. mlabriola@digitalprimates.net 24 June 2010 at 4:26 pm #

    Adding it to the ant task is unfortunately the easy part. Having somewhere to put it in the JUnit report format is what is causing us grief.

  3. bzim 2 September 2010 at 9:30 am #

    Where can I download FlexUnit4.swc and supporting libraries?

    To my current experience there is no placed to find it by links offered from this place.

  4. Simeon Bateman 3 September 2010 at 3:17 pm #

    The “Download” section at the top of the page contains zip files you can download depending on the version of the SDK you are using.

    All the required swc’s as well as a sample project are included in the zip files.

    HTH
    sim

  5. labriola 3 September 2010 at 3:19 pm #

    Did you try the download link?

  6. jacks 16 September 2010 at 9:56 am #

    Hi,
    Doess it work with google maps for testing an application.

  7. Marcus Stade 23 September 2010 at 8:06 am #

    Are there any instructions available for how to update the FlexUnit version included with Flash Builder?

  8. Arnoud Bos 29 October 2010 at 8:43 am #

    Great news!

    Any chance that this will be hosted on a public maven repo? Adobe has the infrastructure at opensource.adobe.com so it shouldn’t be too hard as PMD does it too there.

    Anyway thanx FlexUnit4 is great!

    Arnoud

  9. Marcus Stade 15 February 2011 at 4:23 pm #

    I second Arnoud on this, having artifacts in public repos would be nice.


Leave a Reply