Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Flex Unit 4 Feature Overview

4,398 views

Published on

A quick feature overview on FlexUnit 4

Published in: Technology, Business
  • Be the first to comment

Flex Unit 4 Feature Overview

  1. 1. FlexUnit 4 Feature Overview Jeff Tapper Digital Primates [email_address] Twitter: jefftapper
  2. 2. Features <ul><li>Support for all JUnit 4 features </li></ul><ul><li>Metadata driven </li></ul><ul><li>Exception Handling </li></ul><ul><li>Async Support </li></ul><ul><li>Hamcrest Support </li></ul><ul><li>Runners </li></ul><ul><li>Theories and Assumptions </li></ul><ul><li>Now Available </li></ul>
  3. 3. Metadata tags <ul><li>[Test] </li></ul><ul><li>[Suite] </li></ul><ul><li>[Before] </li></ul><ul><li>[After] </li></ul><ul><li>[BeforeClass] </li></ul><ul><li>[AfterClass] </li></ul><ul><li>[Ignore] </li></ul>
  4. 4. Exception handling <ul><li>When a test expects to throw an error, test code traditionally requires more work (try/catch/assert) </li></ul><ul><li>New expects attribute of Test metadata allows us to define an expected exception </li></ul><ul><li>[Test(expects=&quot;TypeError&quot;)] public function divisionWithException():void {    simpleMath.divide( 11, 0 ); } </li></ul>
  5. 5. Async Support <ul><li>[Test(async,timeout=&quot;500&quot;)] </li></ul><ul><li>public function doSomethingAsynchronous():void {} </li></ul><ul><li>Async.proceedOnEvent( testCase, target, eventName ); </li></ul><ul><li>Async.failOnEvent( testCase, target, eventName ); </li></ul><ul><li>Async.handleEvent( testCase, target, eventName, eventHandler ); </li></ul><ul><li>Async.asyncHandler( testCase, eventHandler ); </li></ul><ul><li>Async.asyncResponder( testCase, responder ); </li></ul>
  6. 6. Hamcrest Support <ul><li>Making use of the HamcrestAS3 project, a new, rich set of asserts are now available </li></ul><ul><li>[Test] </li></ul><ul><li>public function isItInHere():void { </li></ul><ul><li>var someArray:Array = [ 'a', 'b', 'c', 'd', 'e']; </li></ul><ul><li>   assertThat( someArray, hasItems(&quot;b&quot;, &quot;c&quot;) ); </li></ul><ul><li>} </li></ul><ul><li>[Test] </li></ul><ul><li>public function isItClose( num1:Number, num2:Number):void{ </li></ul><ul><li>assertThat ( num1, closeTo(num2,.01)); </li></ul><ul><li>} </li></ul>
  7. 7. Runners <ul><li>Suites can be decorated with [RunWith] metadata to define the test runner </li></ul><ul><li>[RunWith(&quot;org.flexunit.runners.Suite&quot;)] </li></ul><ul><li>Allows for running tests written in other testing frameworks to run in FU4 </li></ul><ul><li>Runners currently exist for FlexUnit1,FlexUnit4,Fluint,SLT, and more on the way </li></ul>
  8. 8. Theories Datapoints and Assumptions <ul><li>Allows for a single test to be run with several different pieces of data </li></ul><ul><li>[DataPoints] [ArrayElementType(&quot;String&quot;)] public static var stringValues:Array = [&quot;one&quot;,&quot;two&quot;,&quot;three&quot;,&quot;four&quot;,&quot;five&quot;]; </li></ul><ul><li>[DataPoints] [ArrayElementType(&quot;int&quot;)] public static function provideData():Array {    return [-10, 0, 2, 4, 8, 16 ]; } </li></ul><ul><li>[Theory] public function testStringIntCombo( value:int, stringValue:String ):void {             //call some method and do something } </li></ul>
  9. 9. Now Available <ul><li>Beta 1 went public on opensource.adobe.com on Monday. </li></ul><ul><li>Feature requests and bugs can be files in Adobe’s JIRA system </li></ul><ul><li>More Info at: </li></ul><ul><li>http://opensourece.adobe.com </li></ul><ul><li>http://blogs.digitalprimates.net </li></ul>

×