Slide 1

Slide 1 text

Macoun ⌘

Slide 2

Slide 2 text

Praxistaugliches UI-Testen Peter Steinberger - @steipete

Slide 3

Slide 3 text

PSPDFKit

Slide 4

Slide 4 text

Modultests

Slide 5

Slide 5 text

FBSnapshotTestCase

Slide 6

Slide 6 text

UIAutomation

Slide 7

Slide 7 text

XCUI

Slide 8

Slide 8 text

Calabash

Slide 9

Slide 9 text

KIF

Slide 10

Slide 10 text

UIApplication.sharedApplication.keyWindow.layer.speed = 100 “Wahnsinnige Geschwindigkeit”

Slide 11

Slide 11 text

typedef NS_ENUM(NSUInteger, PSPDFTestCaseSpeed) { PSPDFTestCaseSpeedNormal = 1, PSPDFTestCaseSpeedCI = 10, PSPDFTestCaseSpeedLudicrous = 100 };

Slide 12

Slide 12 text

- (BOOL)continueAfterFailure { return YES; } Weitermachen

Slide 13

Slide 13 text

- (void)tearDown { [super tearDown]; // Cancel all running render requests let renderQueue = PSPDFKit.renderManager.renderQueue; [renderQueue cancelAllJobs]; PSPDFTestWaitTrue(renderQueue.numberOfQueuedJobs == 0 &&
 renderQueue.numberOfRunningJobs == 0); } Aufräumen

Slide 14

Slide 14 text

CFRunLoopObserverRef observer = CFRunLoopObserverCreateWithHandler(NULL, kCFRunLoopBeforeWaiting, true, 0, beforeWaiting);
 CFRunLoopAddObserver(CFRunLoopGetCurrent(), observer, kCFRunLoopDefaultMode); CFRunLoopRunInMode(kCFRunLoopDefaultMode, timeout, false); CFRunLoopRemoveObserver(CFRunLoopGetCurrent(), observer, kCFRunLoopDefaultMode); CFRelease(observer); Lauf-Schleife !

Slide 15

Slide 15 text

void *handle = dlopen(@“/usr/lib/libAccessibility.dylib”, RTLD_LOCAL); 
 void (*_AXSSetAutomationEnabled)(int) = dlsym(handle, "_AXSSetAutomationEnabled"); 
 _AXSSetAutomationEnabled(YES); Zugänglichkeits Inspektor

Slide 16

Slide 16 text

[[UIApplication sharedApplication] sendEvent:event]; Ereignisse schicken

Slide 17

Slide 17 text

- (id)initAtPoint:(CGPoint)point relativeToWindow:(UIWindow *)window { if (self = [super init]) { [self setTapCount:1]; [self setIsTap:YES]; [self setPhase:UITouchPhaseBegan]; [self setWindow:window]; [self _setLocationInWindow:point resetPrevious:YES]; [self setView:[window hitTest:point withEvent:nil]]; [self _setIsFirstTouchForView:YES]; [self setTimestamp:[[NSProcessInfo processInfo] systemUptime]]; } return self; } Druckpunkte bauen

Slide 18

Slide 18 text

IOHIDEventRef IOHIDEventCreateDigitizerFingerEvent(CFAllocatorRef allocator, AbsoluteTime timeStamp, uint32_t index, uint32_t identity, IOHIDDigitizerEventMask eventMask, IOHIDFloat x, IOHIDFloat y, IOHIDFloat z, IOHIDFloat tipPressure, IOHIDFloat twist, Boolean range, Boolean touch, IOOptionBits options); Eingabegeräte Ereignisse

Slide 19

Slide 19 text

DEMO (KIF)

Slide 20

Slide 20 text

DEMO (XCUI)

Slide 21

Slide 21 text

EarlGrey

Slide 22

Slide 22 text

struct rebinding rebindings[] = { {"dispatch_after", grey_dispatch_after, NULL}, {"dispatch_async", grey_dispatch_async, NULL}, {"dispatch_sync", grey_dispatch_sync, NULL}, {"dispatch_after_f", grey_dispatch_after_f, NULL}, {"dispatch_async_f", grey_dispatch_async_f, NULL}, {"dispatch_sync_f", grey_dispatch_sync_f, NULL}, }; rebind_symbols(rebindings, sizeof(rebindings) / sizeof(rebindings[0])); Angelhaken

Slide 23

Slide 23 text

Adressensäuberer (ASan)

Slide 24

Slide 24 text

No content

Slide 25

Slide 25 text

GREYConfiguration.setValue(false, forConfigKey: kGREYConfigKeyAnalyticsEnabled) Sei nicht böse.

Slide 26

Slide 26 text

DEMO (EarlGrey)

Slide 27

Slide 27 text

Video PSPDFKit UI Tests

Slide 28

Slide 28 text

CI!

Slide 29

Slide 29 text

Abschluss

Slide 30

Slide 30 text

pdfviewer.io

Slide 31

Slide 31 text

pspdfk.it/blog/2016/ui-testing-revisited pspdfk.it/blog/2016/test-with-asan Macoun-Exklusiv-Vorschau Danke! Fragen?