- (void)setUp
{
[super setUp];
@try {
[Problem setupProblem];
}
@catch (NSException *exception) {
NSLog(@"exception Caught %@: %@", [exception name], [exception reason]);
STFail(@"Should Pass, no exception is expected. Exception <%@>", exception);
}
}
- (void)tearDown
{
// Tear-down code here.
@try {
[Problem teardownproblem];
}
@catch (NSException* exception) {
NSLog(@"exception Caught %@: %@", [exception name], [exception reason]);
STFail(@"Should Pass, no exception is expected. Exception <%@>", exception);
}
}
-(void)testGetComponentNil{
id testComponet = (id<Solution>)[Problem getComponent:nil];
STAssertNil(testComponet, @"Return Nil");
STAssertNotNil(id<Solution>[problem getComponent:@"Problem"], @"");
}
exception Caught NSInternalInconsistencyException: Cannot teardownProblem() before setupProblem()
<Cannot teardownProblem() before setupProblem().>
对于我的信息,第一个 setup 方法将被调用并调用 testcaseMethod,然后会调用 tear down。它在安装前拆解,任何人都在这个问题上建议我为什么在安装前拆解。