Archive for October 5th, 2009

05
Oct

Simple Unit Testing

So you read our earlier post on unit testing but haven’t gotten around to actually setting it up yet? Well, here’s a simpler way to dip your toes into the water:

One of the biggest gripes that folks have about the built in unit testing for Xcode is that it’s a pain to setup and debug. I’ve also hear from folks that this is the reason they don’t write tests, which is a shame. But I’m going to share a little secret with you today: thanks to Objective-C, it’s pretty darn easy to roll your own solution.

Here’s some code for you: CallTestMethods.m

I’ve even got it hooked up to my build process these days; I launch Acorn from my build script with a -runtests argument, and away it goes. I’m not sure how much easier it could be. It’s very low friction and easy to debug, which is important to me.

Ah, yes. It’s all about the low friction, isn’t it?