My colleague and I have been struggling with unit tests now for weeks. We have tried to get SenTest, GTM, and other frameworks set up, but we can never get past a gnarly ball of linking errors.
Here's where I am now with GTM. I would appreciate any guidance.
Beyond helping out on SO, if you have experience with this, I'd happily pay a consultant. Please email me at [email protected] if you think you can help me with this.
I followed the instructions here: http://code.google.com/p/google-toolbox-for-mac/wiki/iPhoneUnitTesting. I found I also needed to add the file "GTMObjC2Runtime.h" to the project. Then, I was able to get to the point where I got the expected console output after installing the framework: "Executed 0 tests, with 0 failures (0 unexpected) in 0.030 (0.030) seconds"
Next, I went to write a test case for one of my classes. I created WebAPITest.h. I created a simple test, which worked fine. I just verified 1 == 1.
Next, I decided to write a test for my AppDelegate.h. So, I added #import "AppDelegate.h" to WebAPITest.h, and I got 8 linking errors. My project uses FBConnect, and the compiler complain that it can't find the FBConnect files. To address this, I added the the FBConnect header search path to the Test target's build config, and the linking errors went away.
Now is where I am stumped. When I try and reference AppDelegate in the implementation, I get these linking errors:
Building target “fooTest” of project “foo” with configuration “Debug” — (2 errors)
Undefined symbols: ".objc_class_name_AppDelegate", referenced from: literal-pointer@_OBJC@_cls_refs@AppDelegate in WebAPITest.o ld: symbol(s) not found collect2: ld returned 1 exit status
So, I tried adding AppDelegate to the Test target, but then it started wanting all the dependencies for AppDelegate too, and I'm guessing I'm not supposed to add dozens of files to the unit test target.
Any idea what I need to do next?