Unit testing on the iPhone

Thanks to Google, there's a unit-testing framework for the iPhone. There's not much more to say about it -- the instructions are crystal clear and it worked exactly as described. It's compatible with OCUnit (the Objective-C unit test framework in XCode), so once you set it up, you can just create test cases the way you would for any ObjC project.

One quirk -- it instructs you to add a build step that runs the unit-tests during build time and shows the failures as compiler errors that you can then use XCode to track down. That's nice, but I have found that you don't really have enough of an environment to successfully run every kind of test -- they run fine if you run them in the simulator. The main problem I have is with setting up my database in my Documents folder -- I get errors at build-time that work just fine at run-time.

Get iPhone programming tips in your inbox with my Beginner iPhone Programming Tips newsletter.