Quantcast
Channel: Adobe Community : Popular Discussions - FlexUnit
Viewing all articles
Browse latest Browse all 25673

Async Integration Testng

$
0
0

I have looked through the forums and also search Google, but I cannot seem to find a solution that fits.

 

I am doing integration testing using FlexUnit 4 with a Swiz framework for events. I ran my code and it works as expected, but I want to ensure it keeps working by setting up tests. I have set up unit tests to confirm each part of the program and stubbed out as required. This all works fine. Next part I am working on  (and struggling with) is the integration or end-2-end tests.

 

My thinking is I start at a point in the program that then calls other parts via Events (Swiz dispatchEvents) and these in turn may call other events. It is very much in sequence and I want to confirm this sequence and the variables set at each point. So I did the following

 

========================

[Test(async)]

public function setInitialViewTest():void

{

     Async.handleEvent(this, presenter.eventDispatcher, "event1", checkVars1, 500, null, noEventFired);

     Async.handleEvent(this, controller.eventDispatcher, "event2", checkVars2, 500, null, noEventFired);

     Async.handleEvent(this, presenter.eventDispatcher, "event3", checkVars3, 500, null, noEventFired);

     presenter.setInitialView();

}

 

public function checkVars1(someEvent:MyEvent, data:Object):void

{

     // Check some variables

}

 

public function checkVars2(someEvent:MyEvent, data:Object):void

{

     // Check some variables

}

 

public function checkVars3(someEvent:MyEvent, data:Object):void

{

     // Check some variables

}

 

======================

 

Problem I run into is that it works fine for two events, but when I add a third or a fourth in the mix I keep getting Error:Asynchronous Event of of order. I then move event3 between event 1 and event2 and it works, but adding event4 check kills it again. The code being check is really simple and fires the events in sequence and the presenter and controller listen and then fire the next event.

 

Question is:

 

Can I use FlexUnit 4 for this kind of sequence related async testing? Am I missing something here?

 

Thanks

Des


Viewing all articles
Browse latest Browse all 25673

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>