Flex Event Handlers

What methods do you use for unit test event handlers, especially if they need information from the event (for example, mouse coordinates or the purpose of the event)? Is it the most common practice to simply reorganize the behavior into a method that does the lifting while the handler simply extracts information from the event, or are there effective ways to simulate sending events to FlexUnit or Fluint?

+5
source share
1 answer

Most often, I create an event object manually and dispatch the event from the object that is being listened to, especially since I can make sure that there are no floating event listeners that are not being deleted properly. Sometimes I come across a situation where my test classes cannot access the sending object. In this case, I separate the business logic from the actual event listener method, keep the event listener method extremely simple and easy, and check the business logic. Sending from an object is much better if you can.

FlexUnit and Flunit do not provide any "simulation" of event scheduling; if you can access the object, you can send it, and if you do not, FlexUnit / Flunit cannot either.

, FlexUnit/Flunit . , , , , . FlexUnit ASDocs, Flunit - : http://code.google.com/p/fluint/wiki/AsyncTest

+3

All Articles