Click here to load reader
Upload
brian-hu
View
108
Download
0
Embed Size (px)
Citation preview
Spec & Integration Testing
Brian Hu
What is a spec
• helps you think as a user rather than a developer
• helps your coworkers understand your work
What is an integration test
• occurs after unit test
• tests the relations between different methods
• tests the flow and UI of your app
Today’s Goal
• Writing a basic spec with Specta
• Writing basic integration tests with KIF
Podfile
platform :ios, '7.0' target :XCTestTutorialTests do pod 'Specta', '~> 0.2.1' pod 'KIF', '~> 3.0' end
Spec example#import <KIF.h> #import <Specta.h> !SpecBegin(SignUp) !describe(@"SignUpProcess", ^{ it(@"should success if I enter correct info", ^{ [tester enterText:@"[email protected]" intoViewWithAccessibilityLabel:@"email"]; [tester tapViewWithAccessibilityLabel:@"submit"]; [tester waitForViewWithAccessibilityLabel:@"success"]; }); }); !SpecEnd
Your tasks
• completing the success behaviour
• making a fail behaviour
Code you may need
UILabel *signUpStatusLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 100, 30)]; [signUpStatusLabel setText:@"success"]; [signUpStatusLabel setAccessibilityLabel:signUpStatusLabel.text]; [self.view addSubview:signUpStatusLabel];