Praxistaugliches UI Testing

Praxistaugliches UI Testing

832ece085bfe2c7c5b0ed6be62d7e675?s=128

Peter Steinberger
PRO

October 03, 2016
Tweet

Transcript

  1. Macoun ⌘

  2. Praxistaugliches UI-Testen Peter Steinberger - @steipete

  3. PSPDFKit

  4. Modultests

  5. FBSnapshotTestCase

  6. UIAutomation

  7. XCUI

  8. Calabash

  9. KIF

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

  11. typedef NS_ENUM(NSUInteger, PSPDFTestCaseSpeed) { PSPDFTestCaseSpeedNormal = 1, PSPDFTestCaseSpeedCI = 10,

    PSPDFTestCaseSpeedLudicrous = 100 };
  12. - (BOOL)continueAfterFailure { return YES; } Weitermachen

  13. - (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
  14. CFRunLoopObserverRef observer = CFRunLoopObserverCreateWithHandler(NULL, kCFRunLoopBeforeWaiting, true, 0, beforeWaiting);
 CFRunLoopAddObserver(CFRunLoopGetCurrent(), observer,

    kCFRunLoopDefaultMode); CFRunLoopRunInMode(kCFRunLoopDefaultMode, timeout, false); CFRunLoopRemoveObserver(CFRunLoopGetCurrent(), observer, kCFRunLoopDefaultMode); CFRelease(observer); Lauf-Schleife !
  15. void *handle = dlopen(@“/usr/lib/libAccessibility.dylib”, RTLD_LOCAL); 
 void (*_AXSSetAutomationEnabled)(int) = dlsym(handle,

    "_AXSSetAutomationEnabled"); 
 _AXSSetAutomationEnabled(YES); Zugänglichkeits Inspektor
  16. [[UIApplication sharedApplication] sendEvent:event]; Ereignisse schicken

  17. - (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
  18. 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
  19. DEMO (KIF)

  20. DEMO (XCUI)

  21. EarlGrey

  22. 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
  23. Adressensäuberer (ASan)

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

  26. DEMO (EarlGrey)

  27. Video PSPDFKit UI Tests

  28. CI!

  29. Abschluss

  30. pdfviewer.io

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