mobile app automated testing

22
Utsav Hello I’m

Upload: xebia-it-architects

Post on 14-Jan-2015

1.632 views

Category:

Technology


1 download

DESCRIPTION

The slides cover the challenges faced in developing an #automated #mobile #app (iOS/Android) project, as well as tips and tricks that can used to quickly achieve it with multiple platform without duplicate code & less efforts using #Calabash.

TRANSCRIPT

Page 2: Mobile App Automated Testing

Netherlands | USA | India | France | UK

SOFTWARE DEVELOPMENT DONE RIGHT

www.xebia.in; Blog :http://.xebee.xebia.in

Page 3: Mobile App Automated Testing

Mobile App Automated Acceptance

Testing Utsav Sinha

Page 4: Mobile App Automated Testing

Problems• Development and Maintenance

• Adaptable to changes

• Accuracy

• Completeness

Page 5: Mobile App Automated Testing

Automated Testing - Desiderata

• Use Cases are the Test Cases.

• Robust

• Realistic Environment (Real Devices, Multiple OS Versions….)

• Continuous Integration

• Comprehensive Test report for each step.

• Flexible Report output formats.

Page 6: Mobile App Automated Testing

• Cucumber Provideso a framework for writing software specificationso a tool for executing those specifications.

• Specifications are written DSLs

• Works with Ruby, Java, .NET, Flex and many more

• http://cukes.info/

Page 7: Mobile App Automated Testing

Example – Feature

Page 8: Mobile App Automated Testing

Step Definition• Make Cucumber Tests come alive.

• Written in various Programming Language (mostly Ruby)

Page 9: Mobile App Automated Testing

Calabash• One Interface Cucumber for iOS and Android

o Reuse of Test Cross Platform (iOS and Android)

• Targets Native and Hybrid apps for Android and iOS

• Runs on Physical Device• Support for Hybrid Apps (embedded web-views)• Open Source Tool• Cross Platform Testing

Page 10: Mobile App Automated Testing

Calabash iOS - architecture

• Calabash tests are executed with the Cucumber tool and consist of two parts:

• Client Library written in Ruby

• Calabash.framework, a server framework written in Objective-C

Page 11: Mobile App Automated Testing

Calabash iOS• To use Calabash we make a special test target in

Xcode that links with calabash.framework• The Server Framework starts HTTP Server inside

the App, that listens to the request from Client Library.

• The Cucumber tool executes the feature file that represents the intended behaviour of the App Under Test.

• The Feature Files contains steps (Predefined or Custom)

Page 12: Mobile App Automated Testing

Calabash Android- architecture

• Features

• Step-Definitions

• Instrumentation Test Server: This is another app which will be installed and executed into device.

Page 13: Mobile App Automated Testing

Calabash iOS• App is built for Testing by linking a static library

(calabash-server)o Uses a combination of UIAutomation and other APIs

• Supports Interactive test-development

• Based on Frank but changes some core parts.o Setting up Frank Requires modification of the app source, inclusion of static

resources and source files manually, where as Calabash has Automated Set Up.  3 commands and we are done

• Touch Synthesis supports multi-touch, gestures

• Can use device accessibility for identifying views

Page 14: Mobile App Automated Testing

Queries• Explore the App Interactively• Run Command ‘calabash-ios console’• It gives us a Calabash console (it is just a Ruby irb with calabash loaded)• Example -

irb(main):001:0> query("button")

[0] { "class" => "UIButton", "frame" => { "y" => 20, "width" => 101, "x" => 20, "height" => 101 }, "UIType" => "UIControl", "description" => "<UIButton: 0x4cc1120; frame = (20 20; 101 101); opaque = NO; autoresize = RM+BM; layer = <CALayer: 0x4c89cc0>>" },

Returns an array with objects that are descriptions of the buttons in the current screen in your app

Page 15: Mobile App Automated Testing

Queries• The query function

o takes a string query as an argument.o the query argument is similar to a css selector

• The syntax for queries is based on UIScript, o but is a new implementation with additional features added (and some

removed).

• UIScript gives a nice "CSS-selector" like approach to finding view objects in your app screens.irb(main):001:0> query("tabBarButton").count => 4

irb(main):002:0> query("tabBarButton")[0] => {"class"=>"UITabBarButton", "frame"=>{"y"=>1, "width"=>76, "x"=>2, "height"=>48}, "UIType"=>"UIControl", "description"=>"<UITabBarButton: 0x856a820; frame = (2 1; 76 48); opaque = NO; layer = <CALayer: 0x856d210>>" }

Page 16: Mobile App Automated Testing

Let’s test…

Page 17: Mobile App Automated Testing

Prototype gestures• Calabash iOS has a number of built-in event

sequences that can be played back.o (touch, swipe, pinch, etc)

• Events can be relocated (translated) to different views, and optionally offsets.

• Extensible: you can record your own gestures if none of the built in suits you.

Page 18: Mobile App Automated Testing

Summary• Calabash iOS tradeoffs and mitigations DSLs: Cucumber, and Query

language (decl, high level)

• Full power of Ruby in tests

• Advanced touch synthesiso recordings give some brittleness, which is o mitigated by supporting relocating and manipulating of recorded event sequences (which are just lists of

dictionaries).

• Interactive development experience

• Requires linking of a framework

• Not good for some games (randomness, “gameplay” & “feel”, timing critical)

• Not good for Phone-to-Phone coordination (call, text, bluetooth)

Page 19: Mobile App Automated Testing

Thank You!!

Utsav [email protected]

Page 20: Mobile App Automated Testing

References• https://github.com/calabash

• https://github.com/calabash/calabash-ios

• https://github.com/calabash/calabash-ios/wiki

• https://github.com/calabash/calabash-ios-server

Page 21: Mobile App Automated Testing

Knowledge Sharing: Speakers in national and international conferences

Functional automation Tools: Selenium/Webdriver, AUTO IT, SoapUI, QTP

Language Proficiencies: Java, Ruby, Groovy, Python

ATDD Tools: Cucumber, Fitnesse, JBehave, Geb

Performance Testing Tools: JMeter, LoadUI

Mobile Testing: Appium, Calabash

Agile Testing

Automation Frameworks in place

- Selenium/Webdriver keyword driven- SoapUI

Current Competencies

Page 22: Mobile App Automated Testing

Contact us @

Xebia [email protected]

Websiteswww.xebia.inwww.xebia.comwww.xebia.fr

Thought LeadershipHtto://xebee.xebia.inhttp://blog.xebia.comhttp://podcast.xebia.com