CHAPTER 1
42
Figure 1-22. Executing FlexUnit tests
Refactor
The only refactoring that you are interested in doing is adding a Metadata to point to the
RetrieveInformationEvent event, so you can get code hints when implementing the class in Flex. Add
the following code to the beginning of the GetEmployeesInfo class:
[Event(name="retriveInformation", type="utils.events.RetrieveInformationEvent")]
You can download the complete example from http://code.google.com/p/advancedflex4/. See
Chapter 1, example: FlexUnitWithTDDExample.
Summary
In this chapter, we covered FlexUnit 4 and Test Driven Development (TDD). We started by giving you an
overview of FlexUnit 4 then we showed you how to create Test Suite, Test Case, and test runner classes.
We covered all the assertion methods available in FlexUnit4, asynchronous Tests, and exception handling.
We also covered the FlexUnit 4 additional assertion methods such as Hamcrest, theories, tests, and
testing User Interfaces.
In the second part of the chapter, we discussed test-driven development with FlexUnit 4. We showed you
how to write a failed test case, write code, test passed, and refractor your code. We hope you are inspired
to use TDD on your mobile, web, and desktop Flash applications to write better, more scalable, and more
reusable code.

Get AdvancED Flex 4 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.