GHUnit Linker Error with Application Classes

I am trying to run the GHUnit test to just verify that the setter really works for the NSManagedObject in my application. My application is called β€œMachine”, and my goal of GHUnit is called β€œTests”. I added the Machine as a function of the testing purpose. My object in the test is called Target. The code is below, and the error in the link is shown below.

#import <GHUnitIOS/GHUnit.h> #import <CoreData/CoreData.h> #import "Goal.h" #import "GoalRec.h" @interface ControllerTests : GHTestCase { } @property (retain) Goal *goal; @end @implementation ControllerTests @synthesize goal; - (BOOL)shouldRunOnMainThread { // By default NO, but if you have a UI test or test dependent on running on the main thread return YES return NO; } - (void)setUpClass { // Run at start of all tests in the class } - (void)tearDownClass { // Run at end of all tests in the class } - (void)setUp { // Run before each test method self.goal = [[[Goal alloc] init] autorelease]; } - (void)tearDown { // Run after each test method self.goal = nil; // prevents memory leak } - (void)testImageArray { NSString *str = @"Hello"; Goal *obj = self.goal; obj.goal = str; GHAssertEqualStrings(obj.goal, @"Hello", nil); } 

@end

Ld / Users / dlwhitehurst / Library / Developer / Xcode / DerivedData / Machine-cscchzscengbcmcmeyzxlkbhumdn / Build / Products / Debug-iphonesimulator / Tests.app / Tests normal i386 cd / Users / dlwhitehurst / Development / Coding / Objective-C iPad setenv MACOSX_DEPLOYMENT_TARGET 10.6 setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin" / Developer / Platforms / iPhoneSimulator .platform / Developer / usr / bin / llvm-gcc-4.2 -arch i386 -isysroot / Developer / Platforms / iPhoneSimulator.platform / Developer / SDKs / iPhoneSimulator4.3.sdk -L / Users / dlwhitehurst / Library / Developer / Xcode / DerivedData / Machine-cscchzscengbcmcmeyzxlkbhumdn / Build / Products / Debug-iphonesimulator -F / Users / dlwhitehurst / Library / Developer / Xcode / DerivedData / Machine-cscchzscengbcmcmeyzxlkbhumdn / Build-Done / Products-Dimit / Debild hurst / Development / Frameworks -filelist / Users / dlwhitehurst / Library / Developer / Xcode / DerivedData / Machine-cscchzscengbcmcmeyzxlkbhumdn / Build / Intermediates / Machine.build / Debug-iphonesimulator / Tests.build / Objects-normal / i386 / Tests.List mmacosx-version-min = 10.6 -ObjC -all_load -Xlinker -objc_abi_version -Xlinker 2 -framework CoreData -framework GHUnitIOS -framework UIKit -framework Foundation -framework CoreGraphics -o / Users / dlwhitehurst / Library / Developer /Dcode Derive cscchzscengbcmcmeyzxlkbhumdn / Construction / Products / Debu r-iphonesimulator / Tests.app / tests

Undefined symbols for i386 architecture: "_OBJC_CLASS _ $ _ Target" referenced: objc-class-ref in ControllerTests.o ld: symbol not found for i386 architecture collect2: ld returned 1 exit status

+5
xcode4 ios4 linker-errors gh-unit
Jun 18 2018-11-18T00:
source share
2 answers

Temporary solution:

Select Target Tests. Select Compile Sources. Then add "Goal.m", you will run the tests.

I'm confused too. I feel like this is crazy. Same: Communication error for unit testing with Xcode 4?

+1
Jun 25 '11 at 11:32
source share

A better solution would be to duplicate the target when creating one for the GHUnit test instead of creating a new target.

0
Dec 16 '13 at 19:42
source share



All Articles