unit testing - Flex, Flexunit: How to test that an event is dispatched twice? -


I use FlexUnit's code to test for some events in the Flex app using the addAsync method. Testing that the incidents are transmitted so far, I can ensure that at least one incident has been removed. However, I want to be a bit more elaborate; I want to make sure that the set of incidents required by me is actually sent. Is there a useful test pattern (or even different test frameworks - I'm flexible!) To accomplish this?

I tried this code, but it did not apply for a second time ResultPropertyChange Expected ResultPropertyChange (Events: Events, NumbersOfAvent: Int = 1): Zero {Trace ("Event" + Event + "" + Event + Target + "+" + + "Number OffIF Events "With" + "trail left ..."); AssertTrue (event.type == Response Chenzed Event.RESPONSE_CHANGED); if ( NumberOfAventis> 1) {event.target.addEventListener (Response Changed Event. REPNSE-Changed, Adesink (Expected Result Portrait Change, 1000, Number OFAVE-1))}} Public Function Testing Some (): Zero {Qualified Q & A} AddEventListener (Response Changed Event. REPNSE-Chianged, ADScNC (required reversible change, 1000, 2)) Expected Question. Choose Response ("1", True); Required Q & A. Symbol selected ("2", true);}

In response to comment. .

What if the incident was sent straightaway? The response does not trigger an asynchronous event on a composite object selected, it is sent directly to the RESPONSE_CHANGED event directly. I do not see how your approach can be used using this method? Note, I'm fuzzy as a fake test practice - that's why I'm getting a simple solution here.

.. In that case you do not need to use a fake or adicink like this:

  Public function test: some (): zero {Var Required question: required question = new required question (); Var callout: int = 0; Expected Quiz.AddentListener (Response Changed Event. RSPNSE-Changed, Function (Event: Response Chained Event) {callCount ++;}); Expected Questions Choose response ("1", true); Q & A required. Counter-notification selected ("2", true); AssertEquals (2, callcount); }  

Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -