Professional Documents
Culture Documents
In iOS
Sam Soffes
@samsoffes
I’m a software engineer
at Scribd in San Francisco
So, testing... *sigh*
No one likes writing tests
Testing is important
Testing is important
̶
few good
There are a lot of options
Unit Testing
GHUnit
OCUnit
- (void)testFirstObject {
NSArray *array = [[NSArray alloc]
initWithObjects:@"foo", @"bar", nil];
GHAssertEqualObjects([array firstObject],
@"foo", nil);
[array release];
}
Download at sstoolk.it
Automated Testing
var target = UIATarget.localTarget();
var application = target.frontMostApp();
var window = application.mainWindow();
var view = window.elements()[0];
var buttons = window.buttons();
if (!button || button.toString() ==
"[object UIAElementNil]") {
UIALogger.logFail("FAIL: The button is
missing.");
} else {
UIALogger.logPass("Pass: The button is
there.");
}
// Tap the button
button.tap();