>From Flex cookbook beta on adobe.com, "How to handle events in a
TestCase?" article:
"Testing behavior in a TestCase often involves waiting for
asynchronous events. If the TestCase methods only concern synchronous
events like property change events fired immediately when the property
is set, no special handling is required. It is only when asynchronous
events are involved that extra care needs to be taken. A common
example would be waiting for a URLLoad to finish or a UIComponent to
finish creation."
My question is: How do I distinguish between the synchronous and
asynchronous events?
>From what is said, if the event is synchronous, then I could test for
event effect in synchronous manner. For example:
public function testSync(){
this.myValue = 0
addEventListener(MySynch.Sync, listener)
dispatchEvent(new MySynch)
assertEquals (this.myValue, 10)
}
public function listener(){
this.myValue = 10
}
Now, if I write the code for WebService send, test code would not
work. Am I getting this right? If so, how do I distinguish between the
synchronous and asynchronous events?
Thanks,
Dan