• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Unit Testing and Run Loops
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Prev by Date: Re: [Moderator] Re: Securely limit the running an application by serial number
  • Next by Date: Fwd: Unit Testing and Run Loops
  • Previous by thread: leaking UIColor objects (correction)
  • Next by thread: Fwd: Unit Testing and Run Loops
  • Index(es):
    • Date
    • Thread