User Scenario based UI testing with KIF

Post on 14-Jul-2015

4.519 views 3 download

Tags:

Transcript of User Scenario based UI testing with KIF

KIFScenario based testing for iOStrippiece Inc. @kitauske

What's UI testing?

Use case scenarionot jsut for a screen

What's use case scenario?

Home → Detail → Buy

User Interface Flow Testing

Main use case scenariosin trippiece

- Home → Detail → Note → Fav

- Home → Favs → Detail → Comment → Note

- Detail → Others Profile → Others favs → Join

Introduction to KIF

target 'Acceptance Tests', :exclusive => true do pod 'KIF', '~> 3.0', :configurations => ['Debug']end

How to use

1.Set AccessibilityLabel

2.Run Action

#import <KIF/KIF.h>

@interface HomeTests: KIFTestCase@end

@implementation HomeTests

- (void)testHome{ [tester tapViewWithAccessibilityLabel:@"HomeTableView"];}

@end

DEMO

Screenshot- (void)capture{ UIWindow *keyWindow = [[UIApplication sharedApplication] keyWindow]; UIGraphicsBeginImageContextWithOptions(keyWindow.bounds.size, NO, 0); CGContextRef context = UIGraphicsGetCurrentContext(); NSArray *windows = [[UIApplication sharedApplication] windows]; [windows enumerateObjectsUsingBlock:^(UIWindow *window, NSUInteger idx, BOOL *stop) { [window.layer renderInContext:context]; }];

UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); [UIImagePNGRepresentation(image) writeToFile:@"hoge.png" atomically:YES];}

GIFImageMagick

convert -delay 100 -loop 1 *.png movie.gif

Work In Progress

- Send screenshots or GIF to S3