Upgrade to Pro — share decks privately, control downloads, hide ads and more …

iOS UI testing

Avatar for beny beny
March 01, 2013

iOS UI testing

Internal presentation about UIAutomation and some extension for it.

Avatar for beny

beny

March 01, 2013
Tweet

More Decks by beny

Other Decks in Programming

Transcript

  1. • Access its UI element hierarchy • Add timing flexibility

    by having timeout periods • Log and verify the information returned by Instruments • Handle alerts properly • Handle changes in device orientation gracefully • Handle multitasking
  2. var testName = "Test 1"; var target = UIATarget.localTarget(); var

    app = target.frontMostApp(); var window = app.mainWindow(); UIALogger.logStart(testName); app.logElementTree(); if (/* something */){ UIALogger.logPass(testName); } else { UIALogger.logFail(testName); }
  3. #import "tuneup/tuneup.js" test("Test 1", function(target, app) { var window =

    app.mainWindow(); app.logElementTree(); assertTrue(/* something */); });
  4. • assertions • window assertion • device handling • better

    delays • keyboard types • ruby console runner (next) What's tuned
  5. 2013-02-28 09:14:29 +0000 Start: Delete keyword 2013-02-28 09:14:29 +0000 Default:

    Check for edit button 2013-02-28 09:14:29 +0000 Default: Checking for added keyword 2013-02-28 09:14:29 +0000 Default: Tapping edit button 2013-02-28 09:14:29 +0000 : target.frontMostApp().mainWindow(). navigationBar().leftButton().tap() 2013-02-28 09:14:29 +0000 Default: Check for delete button 2013-02-28 09:14:30 +0000 Default: Tapping delete button 2013-02-28 09:14:30 +0000 : target.frontMostApp().mainWindow(). tableViews()[0].groups()[0].buttons()["Delete"].tap() 2013-02-28 09:14:31 +0000 Default: Checking for deletion of keyword 2013-02-28 09:14:41 +0000 Pass: Delete keyword Instruments Trace Complete (Duration : 19.321390s; Output : /Users/obenes/Desktop/instrumentscli1.trace) 2 tests, 0 failures TEST PASSED
  6. config: { numberOfEvents: 1000, delayBetweenEvents: 0.05, // In seconds //

    Events are triggered based on the relative weights here. // The event with this highest number gets triggered the most. eventWeights: { tap: 30, drag: 1, flick: 1, orientation: 1, clickVolumeUp: 1, clickVolumeDown: 1, lock: 1, pinchClose: 10, pinchOpen: 10, shake: 1 }, // Probability that touch events will have these different properties touchProbability: { multipleTaps: 0.05, multipleTouches: 0.05,
  7. References iOS Developer Library http://developer.apple.com/library/ios/#documentation/DeveloperTools/Reference/UIAutomationRef/_index.html WWDC 2010 - 306 Automating

    User Interface Testing with Instruments https://developer.apple.com/itunes/?destination=adc.apple.com.4088510335.04088510337.4096407259?i=1391909688 Instruments User Guide http://developer.apple. com/library/ios/#documentation/DeveloperTools/Conceptual/InstrumentsUserGuide/UsingtheAutomationInstrument/UsingtheAutomati onInstrument.html iOS Automated Tests with UIAutomation - Manbolo Blog http://blog.manbolo.com/2012/04/08/ios-automated-tests-with-uiautomation Tune-up - Alex Vollmer https://github.com/alexvollmer/tuneup_js UIAutoMonkey - Jonathan Penn https://github.com/jonathanpenn/ui-auto-monkey