我不是在Objective-C這樣的經歷,但我我想開始使用TDD的iOS開發,爲了這個,我有幾個新手問題:)單元測試
什麼人用於iOS的TDD?我認爲在Xcode中已經使用了Test框架,這是否好?或者更好的選擇?
我試圖做單元測試的一些練習,我創建一個例子,在那裏我有一個TableViewControllerClass,使用CoreLocation,用這種方法:
-(void)startFindLocation
{
[self.cllManager startUpdatingLocation];
}
-(void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations
{
[self.cllManager stopUpdatingLocation];
CLLocation *actualLocation = [locations lastObject];
NSLog(@"latitude: %f", actualLocation.coordinate.latitude);
NSLog(@"longitude: %f", actualLocation.coordinate.longitude);
}
我想考,是很簡單,就是查看CLLocation是否有經度和緯度,而不是使用NSLong。 爲此,我真的需要在我的Test Class中分配並初始化這個TableViewController類?或者有任何框架,類似於Rspec(例如,ruby/rails),我可以檢查應用程序屏幕中的特定標籤是否具有此經度和緯度值?
問候