我有一个 OCUnit 测试类:PatientTestViewControllerTests。下面是界面:
@interface PatientTestViewControllerTests : SenTestCase
@property (nonatomic, strong) PatientTestViewController *testController;
@end
并设置:
- (void) setUp
{
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Testing" bundle:nil];
self.testController = [storyboard instantiateInitialViewController];
}
“测试”故事板是我的应用程序中唯一的故事板,并被设置为应用程序的主故事板。 Patient Tests ViewController 被设置为故事板的唯一视图控制器。
我的测试课中有一项测试:
- (void) testInitialTestingStoryboardViewIsPatientTest
{
STAssertTrue([self.testController isMemberOfClass:[PatientTestViewController class]], @"Instead of the %@, we have %@",[PatientTestViewController class], [self.testController class]);
}
此测试失败并显示以下日志消息:
错误:-[PatientTestViewControllerTests testInitialTestingStoryboardViewIsPatientTest]:“[self.testController isMemberOfClass:[PatientTestViewController 类]]”应该为 true。而不是病人测试视图控制器, 我们有病人测试视图控制器
怎么会这样?自从
[self.testController isMemberOfClass:[PatientTestViewController class]]
显然是假的,测试日志怎么能说两者都是
[self.testController class]
and [PatientTestViewController class]
看起来一样?
附加信息: