Monday, November 24, 2008

Unit Testing using Google Toolbox for Mac

It took some serious trial and error but I am very happy to have unit testing integrated into my project workflow.  I tried using XCode's native integration of OCunit but I couldn't get debugging to work.  

Google Toolbox for Mac, and the getting started tutorial, was much easier to follow and implement.  

I am using JSON in my project and I had trouble getting that SDK to work with unit tests but finally discovered that you have to set the "Additional SDKs" and "Other Linker Flags" in both your app and your Unit Test target.

I highly recommend integrating this framework early on anything not trivial.  It will increase the quality of your code dramatically.  At first, you'll feel like you are writing more code but in actuality, the process of test first will result in less code that does more.  Changing it will be much easier and unless you are already a guru level expert, you'll learn some things down the road that you'll want to go back and redo those early attempts.  Unit tests make that possible.  I'll stop expounding the virtues of TDD and just say: rock!  I feel like a programmer again!