I'm not so experience in Objective-C, but I'm I'd like to start develop in iOS using TDD, for this I have few newbie questions :)
What people are using for TDD for iOS? I was think in use the Test framework that already have in Xcode, is it good? or any better options?
I was trying to do some exercises for unit test, and I was creating an Example, where I have a TableViewControllerClass, using CoreLocation, with this methods:
-(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);
}
What I would like to test, is very simple, is to see if the CLLocation has a latitude and a longitude, instead of using NSLong. For that I really need to alloc and init this TableViewController class in my Test Class? or there's any framework, similar to Rspec (for example, ruby/rails), where I can check if a specific label in the application screen has this value of latitude and longitude?
Regards
I have a series of screencasts on iOS TDD, starting with https://qualitycoding.org/objective-c-tdd/
Regarding your particular question, a unit test needs to check results in one of three ways:
I don't see anything in -locationManager:didUpdateLocations: that leads to any of these. Perhaps you want to TDD a helper method instead.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With