spec & integration testing

Post on 08-May-2015

108 Views

Category:

Technology

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

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:@"test@gmail.com" 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];

top related