views:

266

answers:

1

I'm using kind of a hybrid of Chris Hanson's excellent Xcode unit testing guide.

My program is a (command-line) application (which precludes using the executable itself to run the tests), but I need to be able to debug my unit tests.

So what I have is as follows:

Create test bundle and tests. Create new test target, set bundle loader and test host. Add main target as direct dependency for test target. Create new custom executable otest. Add -SenTest self, MyTestBundle.octest, arguments. Add DYLD_LIBRARY_PATH and DYLD_FRAMEWORK_PATH variables in environment.

My issue is that when I now try to debug a test by running the executable, the classes referenced by the tests are not available. For instance if I write a test for class Foo, as soon as I instantiate Foo in my test I get a bad access exception.

If I add Foo.m to the test target this goes away, but I'd rather not have to add every class I want to test to the test taget as well as the application target.

I assume I just need to add a variable of some sort telling otest where to find the classes in my main executable, but I don't know what the name of this argument would be.

Can somebody point me in the right direction for fixing this?

A: 

On second thought, would the XCInjectBundle and XCInjectBundleInto variables help? They are described in Apple's Automated Unit Testing with Xcode 3 and Objective-C

XCInjectBundle: Unit Tests.octest

XCInjectBundleInto: OCT.app/Contents/MacOS/OCT

Elise van Looij