I recommend you design your test case for your app delegate such that it instantiates an instance of it and calls methods and tests outputs from there.
Consider a structure such as this:
@interface FizzBuzzObjCStudyTest : GHTestCase {
ObjCStudyAppDelegate *appDelegate;
}
@end
@implementation FizzBuzzObjCStudyTest
-(void)setUp
{
appDelegate = [[ObjCStudyAppDelegate alloc] init];
}
-(void)tearDown
{
[appDelegate release];
}
-(void) testAppDelegate
{
GHAssertNotNil(appDelegate, @"Cannot find the application delegate", nil);
// test other methods of ObjCStudyAppDelegate here, or make more test methods.
}
@end
The GHUnit framework bypasses the UI framework that creates the UIApplicationDelegate in the CLI version. In fact, the GUI version of GHUnit is actually instantiating its own UIApplicationDelegate called GHUnitIPhoneAppDelegate.
Here is a snippet from GHUnitIOSMain.m showing how it sets up its own app delegate for the GUI version:
// If GHUNIT_CLI is set we are using the command line interface and run the tests
// Otherwise load the GUI app
if (getenv("GHUNIT_CLI")) {
retVal = [GHTestRunner run];
} else {
retVal = UIApplicationMain(argc, argv, nil, @"GHUnitIPhoneAppDelegate");
}