Unit Testing and Run Loops
Unit Testing and Run Loops
- Subject: Unit Testing and Run Loops
- From: Jamie Hardt <email@hidden>
- Date: Sat, 4 Jul 2009 12:10:23 -0700
Hello all,
I've looked around for writing about this, but I can't really find
anybody who has declared the absolutely right solution to this problem.
I'm using the SenTesting kit and writing a class that initiates a web
download, async using the run loop. How can I write a unit test that
makes sure that the class completes the download? The test case will
only run once, and threads in the unit test tool don't appear to have
run loops, or if they do, they don't appear to iterate. I've walked
friends through this problem before, and the best solution we came up
with is to rewrite all our code as synchronous but inside and
NSOperation, and then we unit test the operations to make sure they
work, and in the app we run the operations through an operation queue.
But does anyone know how to setup something like a stream read or URL
download, and make sure run loop completely services the download/
stream, and then write a unit test that makes sure all this happens?
Jamie
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden