Unit Testing in xcode(Using GHUnit and OCMock) -
in xcode,i trying unit testing using ghunit , ocmock described here :
and set methods descibed here :
but got error in method
- (void)setupclass { }
when initialize viewcontroller object below :
#import <ghunitios/ghunit.h> #import <ocmock/ocmock.h> #import "rs_loginrsviewcontroller.h" @interface samplelibtest : ghtestcase { rs_loginrsviewcontroller * login; } @end @implementation samplelibtest // run before each test method - (void)setup { } // run after each test method - (void)teardown { } // run before tests run class - (void)setupclass { ghtestlog(@"log test ghtestlog(...) test specific logging."); login = [[rs_loginrsviewcontroller alloc]init]; } // run before tests run class - (void)teardownclass { } // tests prefixed 'test' , contain no arguments , no return value - (void)testa { ghtestlog(@"log test ghtestlog(...) test specific logging."); } // override exceptions; default exceptions raised, causing test failure - (void)failwithexception:(nsexception *)exception { } @end
but got error apple mach-o linker error :
undefined symbols architecture i386: "_objc_class_$_rs_loginrsviewcontroller", referenced from: objc-class-ref in sampletestcase.o ld: symbol(s) not found architecture i386 clang: error: linker command failed exit code 1 (use -v see invocation)
but when remove line
login = [[rs_loginrsviewcontroller alloc]init];
from
- (void)setupclass
method runs successfully.why getting error ? appreciated.
i resolved errors adding necessary files , frameworks , library build phases of project target of testing.
Comments
Post a Comment