unit testing flex with flexunit 4 and flash builder 4 n.
Skip this Video
Loading SlideShow in 5 Seconds..
Unit Testing Flex with FlexUnit 4 and Flash Builder 4 PowerPoint Presentation
Download Presentation
Unit Testing Flex with FlexUnit 4 and Flash Builder 4

Loading in 2 Seconds...

  share
play fullscreen
1 / 17
Download Presentation

Unit Testing Flex with FlexUnit 4 and Flash Builder 4 - PowerPoint PPT Presentation

lamond
111 Views
Download Presentation

Unit Testing Flex with FlexUnit 4 and Flash Builder 4

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

  1. Unit Testing Flexwith FlexUnit 4and Flash Builder 4 • Chris Luebcke

  2. Unit Testing - Why? Gets The Bad News Early Improves Technical Design Defines Behavior Documents Code Enables Safe Refactoring Defends Against Regression Bugs Discovers Bugs In Initial Implementation

  3. A Brief History FlexUnit 4 ASUnit flUnit SUnit cfcUnit utPLSQL CUnit JSUnit RUnit EUnit PGUnit xUnit Visual Assert mlUnit GUnit FlexUnit 0.9 xUnit.Net HUnit SimplyVBUnit NUnit FSTest curlUnit RCUnit ShUnit Test::Class Roaster PyUnit googletest csUnit Test::Unit PHPUnit .TEST FRUIT CppUnit FPCUnit jsUnit utMySQL

  4. xUnit Testing Patterns System Under Test (SUT) (a.k.a. your class) CI Test Suite Test Case Fixtures Assertion Test Runner methodOne() Assertion methodTwo() Assertion Fixtures Assertion methodThree() Test Case System Under Test (SUT) (a.k.a. your other class) Assertion Fixtures Assertion Assertion methodOne() Assertion methodTwo() Fixtures methodThree()

  5. Development Practices Old Skool Nu Skool TDD Skool Code Code Test Code Test Code FAIL Code Code Test Test Test Code WIN WIN

  6. (One way to) Add Tests

  7. A Generated Test Class Doesn’t Extend TestClass What I got for specifying “Class to Test” in the wizard. (not all that helpful actually) A commented-out bootstrap (pretty handy, at least at first)

  8. Let’s Make It Assert Something 1. Uncomment the test method 2. Watch it fail because you havent’t imported Assert 3. Import flexunit.flexframework.Assert Fail Use this guy Not this guy

  9. Let’s Run Our Test (finally) Project context menu Run As > FlexUnit Tests Ok!

  10. The Test Runner Nothing to see here, move along.

  11. The Test Results Fail... but why? Hmm? Oh, that’s right

  12. Interlude: Be Assertive General Form Assert.assertSomething([failure message,] parameters) Specifically... Assert.assertTrue(value) Assert.assertFalse(value) Assert.assertEquals(expected value, value) Assert.assertStrictlyEquals(expected value, value) Assert.assertNull(value) Assert.assertNotNull(value) Assert.fail()

  13. A More Useful Test A system... ...under test

  14. Now For Better Coverage Ah, that’s better Eww, let’s fix that

  15. Interlude: That’s Meta(Data) [Test] [Ignore] [Before] [BeforeClass] [Test] [Suite] [After] [AfterClass] [Test(expects=”error class”)] [Test(async,timeout=”250”)]

  16. Exercises Left To The Reader Writing asynchronous tests Continuous Integration Ordering test execution Theories Hamcrest RunWith Adapters What To Test

  17. FIN big ups to Mike Labriola @ Digital Primates, Matt Chotin @ Adobe and everyone else involved in bringing the awesomeness of FU4+FB4 to life http://flexunit.org cluebcke@yahoo.com