Installing in iOS (Xcode 3)
To use GHUnit in your project, you’ll need to create and configure a test target.
- Add a New Target. SelectiOS -> Application. Name itTests(or something similar).
- Copy and add GHUnitIOS.frameworkinto your project: Add Files to …, selectGHUnitIOS.framework, and select theTeststarget.
- Add the following frameworks to Linked Libraries:- GHUnitIOS.framework
- CoreGraphics.framework
- Foundation.framework
- UIKit.framework
 
- In Build Settings, under ‘Framework Search Paths’ make sure the (parent) directory to GHUnitIOS.framework is listed.
- In Build Settings, under ‘Other Linker Flags’ in the Teststarget, add-ObjCand-all_load
- By default, the Tests-Info.plist file includes MainWindowforMain nib file base name. You should clear this field.
- Add the GHUnitIOSTestMain.m file into your project and make sure its enabled for the “Tests” target.
- (Optional) Create and and set a prefix header (Tests_Prefix.pch) and add#import <GHUnitIOS/GHUnit.h>to it, and then you won’t have to include that import for every test.
- Now you can create and run tests!
Installing in Mac OS X (Xcode 3)
To use GHUnit in your project, you’ll need to create and configure a test target.
- Add a New Target. SelectCocoa -> Application. Name itTests(or something similar).
- In the Finder, copy GHUnit.frameworkto your project directory (maybe in MyProject/Frameworks/.)
- In the Teststarget, add theGHUnit.frameworkfiles (from MyProject/Frameworks/). It should now be visible as aLinked Frameworkin the target.
- In the Teststarget, under Build Settings, add@loader_path/../FrameworkstoRunpath Search Paths(Under All Configurations)
- In the Teststarget, addNew Build Phase|New Copy Files Build Phase.- Change the Destination to Frameworks.
- Drag GHUnit.frameworkinto the the build phase
- Make sure the copy phase appears before any Run Scriptphases
 
- Change the Destination to 
- Copy - GHUnitTestMain.minto your project and include in the Test target.
- If your main target is a library: - In the Target 'Tests' Infowindow,Generaltab:- Add a linked library, and select your main target; This is so you can link your test target against your main target, and then you don’t have to manually include source files in both targets.
 
 
- In the 
- If your main target is an application, you will need to include these source files to the - Testproject manually.
- Now create a test (either by subclassing - SenTestCaseor- GHTestCase), adding it to your test target. (See example test case below.)
- By default, the Tests-Info.plist file includes MainWindowforMain nib file base name. You should clear this field.
- Now you can create and run tests!