1
- (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().>
已經爲我的信息第一次設置方法將調用並調用testcaseMethod然後拆除將被稱爲。它在安裝前拆卸, 任何人都可以在這個問題上給我建議,爲什麼在安裝之前拆卸它。異常提出的設置和拆卸OCUnit測試用例
對於我的建立和拆除不應該拋出的異常!我讓STFail知道[Problem setupProblem];已經成功地完成了,也是爲了拆解[Problem teardownproblem];如果這種方法沒有設置拆卸正確,它給了我錯誤的值,無需拋出異常! – Kiran 2013-02-28 04:51:44