Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

unit testing JavaScript results with OCUnit



I was wondering if anyone has had success unit testing _javascript_ results with OCUnit. I think there may be a need to delay execution in OCUnit, in order for the _javascript_ to initialize. I've tried an NSTimer and performSelector:WithObject:Delay: but OCUnit fails silently.

XCode 2.2, OS X 10.4.6

here is an example of my code. LJavaScriptBridge is an object that has a WebView. The WebView is not actually ready to process data until webview:frameDidLoad: is called. This is not a problem if the object is being initialized during deployment, since it will be initialized at startup.

The unit test:

http://paste.lisp.org/display/19409

code execution does not go beyond -performSelector:afterDelay:(similar results with an NSTimer).

I'm pretty certain that this is the actual problem since, if I don't include the delay code, I get this as an error from OCUnit:

/p4/MacTitus/branch_michaelh/tests/LJavaScriptBridgeTest.mm:24: error: -[LJavaScriptBridgeTest testRoot] : '(null)' should be equal to 'FOO'

and testing manually returns expected results.

without the delay code:

http://paste.lisp.org/display/19409#1

any help would be appreciated..
Mike

--
Mike Hanna
iChat: michaelkhanna(AIM)



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webkitsdk-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webkitsdk-dev/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.