我不是在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),我可以检查应用程序屏幕中的特定标签是否具有此经度和纬度值?
问候