Flex is a cli开发者_开发问答ent-side language and based on events. How can such events be mocked to allow unit testing?
Take a look at FlexUnit and FlexMonkey
If you are writing your components to user Interfaces rather than concrete components, mocking objects is as simple as a new implementation.
There are also real mock libraries for AS3. Take a look at this tutorial:
http://www.allenmanning.com/?p=7
and the Mockolate library. I have actually used mock-as3, which is Mockolate's ancestor. With it you can create fake objects that act like dummy facades for things irrelevant to your testing: this way you can focus on testing a specific piece of code (be it in a UI class or not) decoupling it from its dependencies.
精彩评论