我正在使用XCode 3.2.3和iOS 4.0上的OCUnit在我的iPhone应用程序上进行单元测试.我已成功设置我的测试环境以适当地传递和失败基本测试,但是当我导入自己的文件时(在这种情况下,“UserAccount.h”,它无法编译并告诉我:
“_OBJC_CLASS _ $_ UserAccount”,引自:
然后它说“未找到符号”.这让我感到某种链接器错误,但我不知道发生了什么.我已多次建造和清理所有目标,但无济于事.这是我的测试代码:
#import "SomeTestCase.h" #import "UserAccount.h" @implementation SomeTestCase - (void)testUserAccount { // UserAccount.m // UserAccount *testAccount = [[UserAccount alloc] initWithUsername:@"" password:@"" deviceToken:@""]; [testAccount registerNew]; NSLog(@"USERID = %@",testAccount.userID); STAssertEquals([testAccount login],NO,@"Failure: Login should fail with blank username and password."); // should fail with no username or password UserAccount *testAccount2 = [[UserAccount alloc] initWithUsername:@"user" password:@"" deviceToken:@""]; STAssertEquals([testAccount2 login],@"Failure: Login should fail with blank password.");// should fail with no password UserAccount *testAccount3 = [[UserAccount alloc] initWithUsername:@"" password:@"pass" deviceToken:@""]; STAssertEquals([testAccount3 login],@"Failure: Login should fail with blank username.");// should fail with no password } @end
任何建议将不胜感激.
谢谢!
-Matt