Transcript
Page 1: Introduction to UI Automation Framework

UI  Automation  :  A  Primer

Cocoaheads, Ann Arbor October, 2013

Page 2: Introduction to UI Automation Framework

About  Myself…

Principal  Software  Developer  @  Barracuda  Networks Freelance  App  Developer  &  Consultant  

www.priyaontech.com www.lunariasoftware.com

TwiIer:@rajagp

www.priyaontech.com 2

Page 3: Introduction to UI Automation Framework

Test  Categories •  Unit Testing

o  Testing from developer’s perspective. o  Testing that a particular function is right o  Rest of system mocked up

•  Functional Testing o  Testing from user’s perspective. o  Testing that system behaves right

Today  we  talk  about    Functional  Testing

www.priyaontech.com 3

Page 4: Introduction to UI Automation Framework

Functional  Testing  -­‐‑  Manual

•  Pros

o  Non programmer can do it o  No special hardware/software required o  Some aspects have to be manually tested – eg. the actual

rendering, user experience

•  Cons o  Time consuming (regression, large data sets and use cases) o  Lack of Reproducibility/ traceability (“Not sure what I did

exactly to cause the app to crash..”)

www.priyaontech.com 4

Page 5: Introduction to UI Automation Framework

Functional  Testing  -­‐‑  Automated

•  Pros o  Saves time , effort

•  Will offset the initial cost of writing the test scripts o  Consistency / Repeatable / Traceable o  Regression o  Large numbers of test data sets o  Continuous Integration

•  Cons o  Need some programming skills

www.priyaontech.com 5

Page 6: Introduction to UI Automation Framework

Options

www.priyaontech.com 6

Tool Platform Scripting  Language Technical  Details

Calabash iOS/Andoird  (Device  &  Simulator)

BDD.  Feature  descriptions  wriIen  in  Gherkin.  Test  steps  in  Ruby.

Uses  Cucumber  for  driving  tests.  A  HTTP  bounjour  server  runs  in  your  app  and  accepts  commands  from  test  driver  (HTTP/JSON).  Open  Source. Uses  Private  APIs

Frank iOS  (Device  &  Simulator)

BDD.  Feature  descriptions  wriIen  in  Gherkin.  Test  steps  in  Ruby.

Uses  Cucumber  for  driving  tests.  A  HTTP  Frank  server  runs  in  your  app  and  accepts  commands  from  test  driver  over  “Franky”  protocol  (HTTP/JSON).  Open  Source Uses  Private  APIs

KIF iOS  (  Simulator/device)

Objective-­‐‑C Framework  integrated  into  app.  No  HTTP  server  or  external  driver.  Open  Source.  Uses  Private  APIs

Page 7: Introduction to UI Automation Framework

Options

www.priyaontech.com 7

Tool Platform Scripting  Language Technical  Details

Fone  Monkey/  Monkey  Talk

iOS/Andoird  (Device  &  Simulator)  &  Web  Apps

JS,  Obj-­‐‑C,  monkeyTalk  scripts

Record  actions  using  MonkeyTalk  console,  save/edit  script  &  playback.  Open  Source  .  Premium  Support  will  cost  $$$

We’ll  discuss  UIAutomations  today

Page 8: Introduction to UI Automation Framework

UI  Automation •  Automated functional test framework

from Apple •  UI interactions with app driven using

test scripts •  Test scripts written in Javascript •  Test scripts executed using

“Automation” instrument •  Actively developed & maintained

(well….maybe) www.priyaontech.com 8

Page 9: Introduction to UI Automation Framework

UI  Automation •  Good user interaction coverage •  Can work with no/minimal app

changes (recommend UIAccessibility) •  Works on simulators and devices •  Only on apps that are signed with

development profile •  Simplicity

www.priyaontech.com 9

Page 10: Introduction to UI Automation Framework

UI  Accessibility •  Informal Protocol •  Interface to assist people with disabilities •  Uniquely identify every element in the view

hierarchy •  Every UIKit element can be specified to be

accessible, using "label" attribute •  Recommended to use w/ UI Automations

o  In order to interact with an element, you need to identify it

•  Identifying element by position makes script fragile

www.priyaontech.com 10

Page 11: Introduction to UI Automation Framework

UI  Accessibility  Rules •  Individual View

o  Enable Accessibility o  Set Accessibility Label on the view

•  Container View o Disable Accessibility on container view o  Enable Accessibility on every contained view

that you want accessible o  Specify Labels for container and contained views

www.priyaontech.com 11

Page 12: Introduction to UI Automation Framework

UI  Element  Hierarchy

www.priyaontech.com 12

Target

Application

Window

View View

UIATarget.localTarget()

.frontMostApp()

.mainWindow()

[UIAElement].logElementTree()

Page 13: Introduction to UI Automation Framework

Tuneup.js •  A set of Javascript utilities to facilitate writing

of UIAutomation scripts •  Lot of convenience Wrapper functions to

handle repetitive tasks(isDeviceiPad, isDeviceiPhone ,assertLeftButtonNamed …)

•  Enforce a structure to your test scripts – Invoke “test” function

•  Alex Vollmer, http://www.tuneupjs.org

www.priyaontech.com 13

Page 14: Introduction to UI Automation Framework

Demo   Get  it  at  :    hIp://priyaontech.com/ndownloads

www.priyaontech.com 14

Page 15: Introduction to UI Automation Framework

Thank  you!    Further  Reading  :  Test  iOS  Apps  with  UI  Automation  Bug  Hunting  Made  Easy  

By  Jonathan  Penn  

www.priyaontech.com @rajagp

www.priyaontech.com 15


Top Related