【发布时间】:2013-02-27 23:58:24
【问题描述】:
- (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。它在安装前的拆解, 任何人都在这个问题上建议我为什么在设置之前拆解。
【问题讨论】: