如何在Objective C單元測試中添加構造函數?如何在客觀c單元測試中添加構造函數?
隨着defaut Xcode的測試代碼:
#import "MultiVueTests.h"
@implementation MultiVueTests
- (void)setUp
{
[super setUp];
// Set-up code here.
}
- (void)tearDown
{
// Tear-down code here.
[super tearDown];
}
- (void)testExample
{
STFail(@"Unit tests are not implemented yet in MultiVueTests");
}
它可以添加構造在該文件中所有的測試?
* 編輯:* 在我的情況下,它是測試一個webService調用的resutl。 在構造函數中,我調用webService並且每個測試都測試答案。 但是如果我在setUp中調用webService,它會調用每個測試。
由於
沒有更多的信息就無法回答這個問題。你想要構建什麼?測試夾具?你不需要。你正在測試的對象?這可以在'-setUp'或測試方法中完成。還有別的嗎? – 2012-06-01 12:37:25
我已編輯我的問題 – Anthone
請參閱http://stackoverflow.com/questions/3630339/sentestkit-cleaning-up-after-all-tests-have-run –