I am creating a view controller view viewplepleController .. And it has two methods setname and getname .. I am creating a test file for this view controller. my test object name is newTestCase and the method name is testName.
#import "newTestCase.h" #import "viewsampleViewController.h" @implementation newTestCase
in my testName method,
-(void)testName{ NSString *b=@"hello"; v =[[viewsampleViewController alloc] init]; STAssertNotNil(v,@"v doesnt created"); [v setuname:@"hello"]; NSString *a=[v getuname]; STAssertEquals(b,a,@"error:name not equal"); [v release]; } -(void)setUp{ v=[viewsampleViewController alloc]; } -(void) tearDown{ [v release]; }
when i built i got an error
Ld "build/Debug-iphoneos/Unit test.octest/Unit test" normal armv6 cd /Users/anande/Documents/viewsample setenv IPHONEOS_DEPLOYMENT_TARGET 3.1.3 setenv PATH "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin" /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.2 -arch armv6 -bundle -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.1.3.sdk -L/Users/anande/Documents/viewsample/build/Debug-iphoneos -F/Users/anande/Documents/viewsample/build/Debug-iphoneos -F/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.1.3.sdk/Developer/Library/Frameworks -filelist "/Users/anande/Documents/viewsample/build/viewsample.build/Debug-iphoneos/Unit test.build/Objects-normal/armv6/Unit test.LinkFileList" -dead_strip -framework Foundation -framework SenTestingKit -miphoneos-version-min=3.1.3 -o "/Users/anande/Documents/viewsample/build/Debug-iphoneos/Unit test.octest/Unit test" Undefined symbols: "_OBJC_CLASS_$_viewsampleViewController", referenced from: __objc_classrefs__DATA@0 in newTestCase.o ld: symbol(s) not found collect2: ld returned 1 exit status
plz help me
objective-c iphone unit-testing
Almand Dec 22 '10 at 5:23 2010-12-22 05:23
source share