Ios driver presentation copy

35
ios-driver Using Selenium to automate your iOS applications

description

 

Transcript of Ios driver presentation copy

Page 1: Ios driver presentation copy

ios-driverUsing Selenium to automate your iOS

applications

Page 2: Ios driver presentation copy

2Introduction

• Technical Test Lead at Paddypower• [email protected]• https://github.com/nicegraham• Twitter: @nicegraham

• The Technical Test Team• SET – test frameworks, tools and mocking services• Performance Testing• Manage QA environments

• Involved with several OSS projects

Page 3: Ios driver presentation copy

3Testing mobile solutions

• The Problem - Several iOS applications in production, more on the way• Objective-C• Sencha• Hybrid• Pure web apps

• The Solution - Add automated functional testing to our CI process for mobile

Page 4: Ios driver presentation copy

4Our wishlist

Page 5: Ios driver presentation copy

5Apple’s Instruments framework

• Instruments is Apple’s iOS automation framework• It uses the UIAutomation JS library to interact with applications

• The good• Decent interface for running tests• The JS UI Automation library is extensive, well documented• Tight integration to Xcode• Does the heavy lifting of interacting with an application

• The not so good• Tied to a mac for running / debugging tests• No abstraction layer to run tests• Doesn’t scale• Browsing the Element Tree [DOM] is not fun

Page 6: Ios driver presentation copy

6Our wishlist

Page 7: Ios driver presentation copy

7Why Selenium?

• Clean Design• Supports any language or framework

• Stable API• Well on it’s way to becoming a w3c standard

• Already part of our framework• Minimum rework to add support for ios

• The team are used to working with it• BDD used – QAs and BAs create automated scenarios

• Scalability• Selenium provides Grid integration out of the box

Page 8: Ios driver presentation copy

8ios-driver

• What is ios-driver?• Used to drive user journeys on mobile UI• Exposes the underlying Element Tree in a navigable form• Implementation of Selenium API to drive iOS applications• Allows reuse of all existing Selenium infrastructure

• We tried NativeDriver – Google project to solve this problem

• We looked at several other projects in the space but ios-driver• Had the most interesting road map • Written in Java - suits our skills

Page 9: Ios driver presentation copy

9Our wishlist

Page 10: Ios driver presentation copy

10Who develops ios-driver?

• Francois Reynaud (owner Grid project, Se committer)

• Graham Abell, Darragh Grace (NativeDriver)

• Luke Inman-Semerau (iPhoneDriver, Se committer)

• Kevin Menard (Se committer)

• Daniel Wagner-Hall, Micahel Klepikov (Se committer, chromedriver)

• Martin Szulecki (libimobiledevice)

• Jason Evans

Page 11: Ios driver presentation copy

11How ios-driver works

Test Client

Java

C#

Ruby

Python

Selenium

Server

ios-driver

Instruments

WebDriver API

Page 12: Ios driver presentation copy

12Writing tests – Plain old Selenium

Page 13: Ios driver presentation copy

13Our wishlist

Page 14: Ios driver presentation copy

14Localisation

• You can only locate elements by their content

Page 15: Ios driver presentation copy

15Localisation

• Accessing the content

Page 16: Ios driver presentation copy

16Localisation

• Localizing the script

Page 17: Ios driver presentation copy

17Our wishlist

Page 18: Ios driver presentation copy

18Element Inspection

Page 19: Ios driver presentation copy

19Our wishlist

Page 20: Ios driver presentation copy

20Hybrid applications

• Web content can not be automated properly with Instruments

Page 21: Ios driver presentation copy

21Accessing web content in a native app

• Webkit Remote Debug Protocol provides the Webkit Web Inspector over the wire

Page 22: Ios driver presentation copy

22Accessing web content in a native app

Test Client

Java

C#

Ruby

Python

Selenium

Server

ios-driver

Instruments

WKRDPWebDriver API

Page 23: Ios driver presentation copy

23Writing tests for hybrid applications

Interact via Instruments

Switch context from native to web

Interact viaWKRDP

Page 24: Ios driver presentation copy

24Web applications - Mobile Safari

Page 25: Ios driver presentation copy

25Our wishlist

Page 26: Ios driver presentation copy

26Let’s go faster!

Client

HubClient

CI

Selenium Grid

nodenode

node

nodenode

node

nodenode

node

nodenode

node

Page 27: Ios driver presentation copy

27Selenium Grid Extras

Page 28: Ios driver presentation copy

28Our wishlist

Page 29: Ios driver presentation copy

29Adding Native Applications to CI

• The standard process for Selenium testing within CI• Application is deployed by CI tool• Tests are run via a browser • Browser versions change infrequently

• Therefore• There is low volatility with registered Nodes• Traditional nodes are immutable

• Native applications are different• They change on every commit

• An ios-driver node handles this volatility by• Monitoring for new applications• Stops accepting new test sessions• Registers the new capability• Re-opens for business

Page 30: Ios driver presentation copy

30Our Mobile Build Pipeline

• Jenkins slave running on a mac• XCode Jenkins plugin used to

• Build app in release and debug configurations• Unlocks keychain of Jenkins slave to sign app with correct Certs

• Xctool used to • Run the application unit tests• Run static code analysis

• Clokins plugin used to track lines of code• PMD used to detect duplicate code• GCOVR and Cobertura Jenkins plugin used for code coverage analysis• Successful builds kick off functional test with ios-driver• Testflight plugin to distribute good builds via Test Flight

Page 31: Ios driver presentation copy

31Our wishlist

Page 32: Ios driver presentation copy

32What’s next? – ios-driver 0.7.0 release

• New libimobiledevice integration• Better device support, more control over real device state• ios-driver nodes will be able to run on windows & linux• airplay

• Performance logging for MobileSafari• Will be able to generate HAR files

• New inspector• Limited record and playback

• iOS7 Support

Page 33: Ios driver presentation copy

33What’s next? – Selenium 3.0

• “a tool for user-focused automation of mobile and web apps” – Simon Stewart

• The Selenium Project will

• Ensure as much commonality in approach as possible

• Host a suite of tests to facilitate interoperability

• Add extensions to W3C

Page 34: Ios driver presentation copy

34

• Ios-driver• https://github.com/ios-driver/ios-driver• http://ios-driver.github.io/ios-driver/• https://groups.google.com/forum/#!forum/ios-driver• #ios-driver on freenode irc tends to be the best place for help

• Selenium Grid Extras• https://github.com/nicegraham/Selenium-Grid-Extras

• Selenium 3• http://seleniumhq.wordpress.com/2013/08/28/the-road-to-selenium-3/

• Jenkins• https://github.com/facebook/xctool• http://jenkins.quiedeville.org/job/Clokins/• http://pmd.sourceforge.net/• https://github.com/gcovr/gcovr• https://www.testflightapp.com

Links

Page 35: Ios driver presentation copy

35Any questions?