Sunday, October 11, 2009

iPhone dev Stupidity 51: Unit test - how to debug?

XCode doesn't support iPhone unittest very well. 

After trying very hard to setup the SenUnitTest for iPhone, you'll find it can not be injected test - which means your app can't link into the unittest target for symbol resolving. Then you give up and build a non-injected unittest target, build and the test runs. It seems everything is OK.

But when there's a failure, you CAN'T DEBUG it. XCode's unit test use kind of shell script to drive the testing - the failure is buried far away from the debugger. It's really annoying. Robert Martin once said that with unit test he uses debugger less and less - but he doesn't mean he can live without a debugger.

So I switch to google-toolbox-for-mac. It's really sample - using the same SenUnitTest code with iPhone and without too much setup headache. Just a standalone iPhone app with all your test code in it - no magic.

No comments: