I\'m trying to dive into the quite frankly terrible world of unit testing using Xcode (such a convoluted process it seems.)
Basically I have this test class, attempt
You have to have an @implementation
for Show
.
Or you could use
Show* s = [[objc_getClass("Show") alloc] init];
...
or
Show* s = [[NSClassFromString(@"Show") alloc] init];
...
to resolving the class in run-time.
If the target you are testing is an application, you'll need to manually include the Show.h/m files in both your main target and your test target.
I also updated the README to reflect this:
Test
project manually. Sorry for the confusion! Having to include files in both targets is not ideal.
Somehow Apple's example works without duplicating the .m files in the target.
Download Apple's unit testing sample code (iPhoneUnitTests.zip) here:
http://developer.apple.com/IPhone/library/samplecode/iPhoneUnitTests/Introduction/Intro.html
Click on the CalcTests target. Only CalcTests.m is in this target.
Build the target. It builds without any link errors for CalcAppDelegate or other classes.
What's the magic that makes this work?