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

UI Automation

UI Automation

iOS Black-box Testing using Instruments by Apple

Oursky Limited

November 06, 2015
Tweet

More Decks by Oursky Limited

Other Decks in Technology

Transcript

  1. BEFORE TEST RUN YOUR APP THROUGH XCODE ▸ Your app

    must be in DEBUG mode ▸ App downloaded from App Store / TestFlight / HockeyApp won’t work (which are in RELEASE mode) ▸ To Perform automation, your app is suggested to be Built and Run / Profiled directly from Xcode
  2. READY TO TEST RUNNING AUTOMATION ON REAL DEVICE ▸ One

    point to note: If you would like to do this on a real device, remember to turn the following switch ON on your device. ▸ Settings > Developer > Enable UI Automation
  3. START SCRIPTING…OR START CAPTURING! ▸ Automation basically supports Javascript, but

    even if you don’t know anything about programming, you could still create a testing script ▸ Use the Capture button ▸ Press on it. Start your actions. And they will be recorded as a script :D
  4. TESTING TIME RECORD AND TRACE LOG ▸ To run the

    testing script, click the top-left button ▸ To look at the logs during a test, select
  5. TWO TIPS ON SCRIPTING UIALOGGER ▸ logFail ▸ logIssue ▸

    logPass ▸ logStart ▸ logDebug ▸ logError ▸ logMessage ▸ logWarning ▸ Example:
 UIALogger.logPass(“User login success!”);
  6. TWO TIPS ON SCRIPTING ALERT HANDLER ▸ Prepare an alert

    handler before the main script ▸ It will be triggered whenever an alert is detected
  7. SO JUST KEEP CALM AND RUN YOUR TEST COMMON PROBLEMS

    ▸ Testing on real device, but always no response on Capture / Stop instantly on run…
 Did you turn “Enable UI Automation” ON? ▸ Testing on simulator, but type string is not working…
 Go to Simulator Menu > Hardware > Keyboard > Toggle Software Keyboard ▸ Can I run multiple tests at the same time?
 Yes, you can run multiple instruments at the same time. But don’t add the same script to different instruments. They will overwrite each other.
  8. MY SCRIPT IS STILL NOT WORKING AND I DON’T KNOW

    WHY?!?! Add target.delay(1); BUT IT’S NOT COOL AT ALL…