spec & integration testing

8

Click here to load reader

Upload: brian-hu

Post on 08-May-2015

108 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Spec & Integration Testing

Spec & Integration Testing

Brian Hu

Page 2: Spec & Integration Testing

What is a spec

• helps you think as a user rather than a developer

• helps your coworkers understand your work

Page 3: Spec & Integration Testing

What is an integration test

• occurs after unit test

• tests the relations between different methods

• tests the flow and UI of your app

Page 4: Spec & Integration Testing

Today’s Goal

• Writing a basic spec with Specta

• Writing basic integration tests with KIF

Page 5: Spec & Integration Testing

Podfile

platform :ios, '7.0' target :XCTestTutorialTests do pod 'Specta', '~> 0.2.1' pod 'KIF', '~> 3.0' end

Page 6: Spec & Integration Testing

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

Page 7: Spec & Integration Testing

Your tasks

• completing the success behaviour

• making a fail behaviour

Page 8: Spec & Integration Testing

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];