When creating a new project with unit tests, Xcode sets the build configuration to Debug for the Test scheme (same for the Run scheme).
Should I differentiate betwee
Instead of creating a Test build configuration, I:
created a Tests-Prefix.pch file:
#define TEST 1
#import
#import "CocoaPlant-Prefix.pch"
entered its path in the Prefix Header field of the Tests target's build settings.
added the following code to the top of a file I created called MyAppDefines.h, imported in MyApp-Prefix.pch:
#ifdef TEST
#define TEST_CLASS NSClassFromString(@"AppDelegateTests") // any test class
#define BUNDLE [NSBundle bundleForClass:TEST_CLASS]
#define APP_NAME @"Tests"
#else
#define BUNDLE [NSBundle mainBundle]
#define APP_NAME [[BUNDLE infoDictionary] objectForKey:(NSString *)kCFBundleNameKey]
#endif
This allows me to use BUNDLE where ever I mean [NSBundle mainBundle] and also have it work when I run Tests.
Importing SenTestingKit in Tests-Prefix.pch also speeds up the compiling of the SenTestingKit Framework and allows me to leave out #import from the top of all the tests files.