Thanks, Matt! It's nice to know we weren't overlooking something obvious. I will be anxiously awaiting your solution :)
Lawrence --- In [email protected], Matt Chotin <[EMAIL PROTECTED]> wrote: > I have been working on this problem for the last day or two since we need > asynchronous support for our own testing. Unfortunately I'm working on code > that works with the next version of Flex and I therefore can't contribute it > back quite yet. If I have time in the next week or so I'll try to port it > back into a version that will work with 1.5 and send it to Ali for his > approval. As you can imagine it really changes a lot of the underlying > FlexUnit system to prevent the next test from running while waiting for an > asynchronous result so it's not a quick fix :-( > > > > Matt > > > > _____ > > From: lm7e [mailto:[EMAIL PROTECTED] > Sent: Friday, February 11, 2005 7:57 AM > To: [email protected] > Subject: [flexcoders] Re: Asynchrony problem? > > > > > Cumhur, > > I ran into this as well this week. After some tinkering, I came upon > a solution. I extended the FlexUnit TestCase class to make an > AsyncTestCase class from which my own test cases that make > asynchronous calls can inherit. In my case, I was testing my > services like this: > > public function testSomeServiceOperation() { > var service : Object = Services.getInstance > ().getService("someService"); > var pendingCall = service.someOperation(); > pendingCall.resultHandler = Delegate.create(this, > CheckResult); > pendingCall.faultHandler = Delegate.create(this, > ServiceFailed); > } > > public function CheckResult(result : Object) { > ... > asyncAddFailure("", "The test failed."); > ... > } > > public function ServiceFailed(result : Object) { > asyncAddFailure("", "The service threw a fault."); > } > > From AsyncTestCase.as: > public function asyncAddFailure(userMessage : String, > message : String) : Void { > if (userMessage.length > 0) { > userMessage = userMessage + " - "; > } > > mx.core.Application.application.testRunner.runner.treeDataPro > vider.addFailure(this, new Error(userMessage + message)); > > mx.core.Application.application.testRunner.testsTree.dispatch > Event({type:"change"}); > } > > Note that I gave my TestRunner the id of 'testRunner'. > > This is probably not the best solution and I would love to see a > more elegant one. So if anyone has solved this more elegantly, I > would be interested as well. Perhaps there can be a tighter > integration between Cairngorm and FlexUnit. > > Hope this helps (for what it is), > Lawrence > > --- In [email protected], "Cumhur Guzel" <[EMAIL PROTECTED]> > wrote: > > Hi folks, > > > > > > > > We are using cairngorm 0.9 version and and flexunit. > > > > > > > > We would like to create a testcase which initially setting the > input > > values up and then broadcasting an event > > > > > > > > that is creating a web service call at back-end, processing it > > resulting output from web service and updating the view. > > > > > > > > Finally, we would like to test updated view object values against > the > > expected values we know before. > > > > > > > > We have created the test case given below. > > > > > > > > (1), (2) sets the input values for test view. > > > > (3) submits the command > > > > (4)(5) waits for asynchronous web service call to finish. (2000 > > millisecond) > > > > (6) logger to localconnection > > > > (7) assertion > > > > > > > > This test is failing, however it is supposed to pass based on the > Logs > > and execution values supplied. > > > > It seems although we force this test method to stay in idle loop > for > > 2000 milliseconds, web service call is not finished off by the mean > > time. > > > > (I increased the time, it did not work) > > > > It seems problem is rooted to flash player single-threaded > > implementation, > > > > So would you guys recommend any workaround to overcome this > asynchrony > > problem or something else? > > > > > > > > Any help will be appreciated. > > > > > > > > Code piece is given below. > > > > > > > > public function testEndToEnd() { > > > > _root.logonWindow.username.text = "tcfeu"; (1) > > > > _root.logonWindow.password.text = "1"; (2) > > > > EventBroadcaster.getInstance().broadcastEvent("SomeCommand");(3) > > > > var timer:Timer = new Timer();(4) > > > > while (!timer.wait(2000)); (5) > > > > Log.debug("SystemTests testEndToEnd() method has been called"); (6) > > > > assertEquals( "return value is different than expected " , > > > > "value" , > > > > valueReturningFromWebServiceCall ); (7) > > > > } > > > > > > > > > > > > > > > > Cumhur Guzel > > > > Senior Developer > > > > Infomedia Ltd. > > > > Electronic Catalogues Division > > > > Phone: +61 (0) 2 9454 1500 > > > > Direct: +61 (0) 2 9454 1709 > > > > Fax: +61 (0) 2 9454 1888 > > > > Mobile: +61 (0) 401 683 402 > > > > Website: www.infomedia.com.au > > > > > > > > * This email transmission and any attachments may contain > privileged and > > confidential information. If you are not the intended recipient > you are > > not authorised to, read, distribute or reproduce any part of this > > transmission (including any attachments) without the prior written > > consent of the sender. If you have received this email in error, > please > > notify the sender by email immediately. > > > > * Opinions expressed in this email and any attachment are those of > the > > sender and not necessarily the opinions of Infomedia. > > > > * Please scan this email and any attachment for viruses. Infomedia > takes > > all reasonable precautions to ensure no viruses are present in this > > email or accompanying attachments, but does not under any > circumstance > > accept any responsibility for loss or damage caused by viruses. > > > > > > > > > Yahoo! Groups Sponsor > > > > ADVERTISEMENT > > <http://us.ard.yahoo.com/SIG=129pkvl1v/M=298184.6018725.7038619.30011 76/D=gr > oups/S=1705007207:HM/EXP=1108223852/A=2532114/R=2/SIG=12kc0fhp1/*http :/clk.a > tdmt.com/NFX/go/yhxxxnfx0020000014nfx/direct/01/&time=110813745280090 8> > > > <http://view.atdmt.com/NFX/view/yhxxxnfx0020000014nfx/direct/01/&time =110813 > 7452800908> > > > > <http://us.adserver.yahoo.com/l? M=298184.6018725.7038619.3001176/D=groups/S= > :HM/A=2532114/rand=871357747> > > > > _____ > > Yahoo! Groups Links > > * To visit your group on the web, go to: > http://groups.yahoo.com/group/flexcoders/ > <http://groups.yahoo.com/group/flexcoders/> > > * To unsubscribe from this group, send an email to: > [EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED] subject=Unsubscribe> > > * Your use of Yahoo! Groups is subject to the Yahoo! > <http://docs.yahoo.com/info/terms/> Terms of Service.

