Search the web
Sign In
New User? Sign Up
jsunit
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Want your group to be featured on the Yahoo! Groups website? Add a group photo to Flickr.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Asynchronous testing: calling into methods with callbacks   Message List  
Reply | Forward Message #144 of 1225 |
RE: [jsunit] Asynchronous testing: calling into methods with callbacks

Thanks. I discovered that workaround in the archives, but it's a real nuisance
because that means I have to create a new test page for every call. I'm using
webservices (microsoft's webservice.htc) and asynchronous calls. I want to
actually call back into the web service (not mockobject) because I specifically
want to test the web service.

I saw a post dated back to 2001 that had someone who dealt with a similar
problem. They had changed the core jsUnit and requested the changes be rolled
into the release but so far as I could tell they weren't. It was regarding
putting in a retry count for the test methods so they would be rerun until they
returned a 0 or null--basically the same idea you've done for setUpPage, but
applied to the test methods as well.

Thanks,

Joel Shellman


> -----Original Message-----
> From: Curt Arnold
> Sent: Wednesday, January 29, 2003 6:24 PM
> To: jsunit@yahoogroups.com
> Subject: Re: [jsunit] Asynchronous testing: calling into
> methods with callbacks
>
>
> joelshellman wrote:
> > I want to call into a library that uses callbacks. So I want a test
> > that does:
> >
> > function testMyMethod() {
> > myMethod(useThisCallback);
> > }
> > function useThisCallback(myData) {
> > assertTrue("Expected some data", "some data", myData.value); }
> >
> > I just tried this and of course it doesn't work. It succeeds
> > completely ignoring whatever the callback method does. How
> can I make
> > this work?
>
> /jsunit/tests/jsUnitTestLoadData.html and
> jsUnitTestLoadStaff.html are
> tests that require an asynchronous load of test documents before the
> body of the test can run. Basically start your callback in setUpPage
> and when all the callbacks are finished set setUpPageStatus to
> "complete" and the body of the test will run. If the status is not
> changed before the page timeout, the test will fail.
>
> So it would be something like:
>
> var setUpPageStatus;
> var data;
>
> function setUpPage()
> {
> setUpPageStatus = 'running';
> myMethod(useThisCallback);
> }
>
> function useThisCallback(myData)
> {
> if (setUpPageStatus == 'running') {
> data = myData.value;
> setUpPageStatus = 'complete';
> }
> }
>
> function testMyMethod()
> {
> assertTrue("Expected some data", "some data", data);
> }
>
>
>
>
>
>
>
> To unsubscribe from this group, send an email to:
> jsunit-unsubscribe@yahoogroups.com
>
>
>
> Your use of Yahoo! Groups is subject to
> http://docs.yahoo.com/info/terms/
>
>
>
>




Thu Jan 30, 2003 3:27 pm

joelshellman
Offline Offline
Send Email Send Email

Forward
Message #144 of 1225 |
Expand Messages Author Sort by Date

I want to call into a library that uses callbacks. So I want a test that does: function testMyMethod() { myMethod(useThisCallback); } function...
joelshellman <joel.sh...
joelshellman
Offline Send Email
Jan 29, 2003
7:15 pm

... /jsunit/tests/jsUnitTestLoadData.html and jsUnitTestLoadStaff.html are tests that require an asynchronous load of test documents before the body of the...
Curt Arnold
pretzllboy
Offline Send Email
Jan 30, 2003
2:19 am

Thanks. I discovered that workaround in the archives, but it's a real nuisance because that means I have to create a new test page for every call. I'm using...
Shellman, Joel
joelshellman
Offline Send Email
Jan 30, 2003
3:34 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help