Introducing automated functional testing of mobile apps Karl - - PowerPoint PPT Presentation

introducing
SMART_READER_LITE
LIVE PREVIEW

Introducing automated functional testing of mobile apps Karl - - PowerPoint PPT Presentation

Introducing automated functional testing of mobile apps Karl Krukow, CTO, LessPainful GotoAMS, May, 2012 karl@lesspainful.com, @karlkrukow 1 fredag den 25. maj 12 1 About me PhD Computer Science, University of Aarhus, 2006 Developer


slide-1
SLIDE 1

Introducing

automated functional testing of mobile apps

Karl Krukow, CTO, LessPainful GotoAMS, May, 2012 karl@lesspainful.com, @karlkrukow

1

1 fredag den 25. maj 12

slide-2
SLIDE 2

About me

  • PhD Computer Science, University of Aarhus, 2006
  • Developer at Trifork for about 6 years
  • Java enterprise, web tech, JavaScript
  • Ruby, Clojure
  • Last two years as iOS developer
  • Present: CTO & iOS responsible at LessPainful

2

2 fredag den 25. maj 12

slide-3
SLIDE 3

Agenda

  • Automated functional testing for mobile
  • Some desirable properties for a functional testing tool
  • Introduce Calabash
  • Focus on iOS only
  • Live Demo:
  • Calabash iOS
  • LessPainful: test service and device cloud

3

3 fredag den 25. maj 12

slide-4
SLIDE 4

Professional practices?

  • Invest the time once! Get the practices going.

Examples:

  • Unit testing
  • Functional tests (see this talk!).
  • Continuous build
  • Continuous unit test, functional test (code coverage).
  • Static analysis using clang/FindBugs.
  • Automated deployment to users via in-app updates or link in email.
  • Automatic Crash/Error reporting.
  • ...

4

4 fredag den 25. maj 12

slide-5
SLIDE 5

The functional testing story for mobile apps

5

  • Many devices, screens, OS versions, languages.
  • Often a manual process: repetitive, expensive.
  • Regressions, e.g., app crashes
  • Visual appearance of screens matter (alot!)
  • User experience, Design guidelines, branding,...
  • As realistic an environment as practically

possible.

  • simulators/emulators are good, but not enough!

5 fredag den 25. maj 12

slide-6
SLIDE 6
  • Minimize distance between use cases and actual test

code (DSLs?).

  • Expressive and efficient to write.
  • Extensible
  • High-level, declarative (robustness against “minor” UI

changes).

  • Support testing in realistic environments (multiple real

devices, on multiple OS versions, languages).

  • Support Continuous integration.

6

Automated functional testing desiderata

6 fredag den 25. maj 12

slide-7
SLIDE 7

7 fredag den 25. maj 12

slide-8
SLIDE 8
  • Cucumber provides
  • a notation for writing software specifications
  • a software tool for executing those specifications
  • Specifications are written in a business readable

language that is close to natural language.

  • Extremely popular tool for test and specs of

web applications.

  • http://cukes.info/

8 fredag den 25. maj 12

slide-9
SLIDE 9

Cucumber Example

Feature: As an administrator. I want to be able to add and remove users, so I can control access to the application Scenario: Add test user When I touch the Add User button And I fill in text fields as follows: | field | text | | Last Name | Knorr | | Username | knorr | And I touch "Save" Then I should be on the Users screen And I should see a table containing "Knorr" Scenario: ...

9 fredag den 25. maj 12

slide-10
SLIDE 10

Step Definitions

  • Make the cucumber tests “come alive”
  • Written in ordinary programming languages
  • Mostly Ruby (but cucumber-jvm: Java, Clojure,...)

Scenario: Add test user When I touch the Add User button ... When /^I touch the Add User button$/ do btn_txt = 'Add user' touch("button text:#{btn_txt}") end

Feature Step definitions

10 fredag den 25. maj 12

slide-11
SLIDE 11

Execution

  • Executing a test produces a test report
  • for each step, did it succeed or not
  • exception/error message if present
  • Test report formats
  • Machine readable (XML, JSON,...)
  • Human readable, (HTML, console)
  • your own...

11 fredag den 25. maj 12

slide-12
SLIDE 12

12 fredag den 25. maj 12

slide-13
SLIDE 13

Calabash

  • One interface: Cucumber, for Android and iOS.
  • Predefined and custom steps: APIs in Ruby + JVM(wip)
  • Reuse of Cucumber features across platforms possible.
  • Runs on physical devices and simulators.
  • Support for hybrid apps (embedded webviews)
  • Free, open source with optional commercial extras

support, training, consulting, device cloud, private device cloud, enterprise cloud...

13

13 fredag den 25. maj 12

slide-14
SLIDE 14

LessPainful Test Execution Service

  • Execute Calabash tests concurrently on

many devices, OS’es, languages.

  • Visual test reports.
  • Comparison across models and operating

systems.

  • Authentic: Not jailbroken, iOS and Android

devices, rotation.

  • Continuous integration:

calabash-ios submit app.ipa KEY

14 fredag den 25. maj 12

slide-15
SLIDE 15

15 fredag den 25. maj 12

slide-16
SLIDE 16

16 fredag den 25. maj 12

slide-17
SLIDE 17

Calabash iOS: more detail

17

17 fredag den 25. maj 12

slide-18
SLIDE 18

Architecture iOS

iOS App

  • Calabash library

Cucumber (ruby api)

features

Test report (cucumber)

18 fredag den 25. maj 12

slide-19
SLIDE 19

Calabash iOS

  • Very easy to get started for iOS developers/QAs.
  • Declarative query language for finding views.
  • Based on UISpec, but simplified and extended. (New

Implementation, EPL licensed).

  • Advanced touch synthesis.
  • Supports gestures (pan, swipe, pinch, multitouch,...)
  • Extensible.
  • Full power of Ruby programming language for test logic
  • Supports interactive, exploratory test development.
  • Can use device accessibility for identifying views.

19

19 fredag den 25. maj 12

slide-20
SLIDE 20

Queries

  • Queries are like CSS selectors or XPath
  • label text:‘Hello‘
  • label index:2
  • view marked:‘thepane’ label
  • view:‘MyClassName’
  • label {text LIKE ‘Hel*’}
  • webView css:‘#header a.cssclass‘
  • webView xpath:’//node()’

20

20 fredag den 25. maj 12

slide-21
SLIDE 21

Demo:

  • Calabash iOS
  • LessPainful Device Cloud

21

21 fredag den 25. maj 12

slide-22
SLIDE 22

iOS Comparisons

  • Several options available. To my knowledge:
  • Calabash
  • UIAutomation, Apple
  • Zucchini, iOS Testing Framework
  • Frank, Pete Hodgson, ThoughtWorks
  • UISpec, http://code.google.com/p/uispec/
  • FoneMonkey => MonkeyTalk, GorillaLogic
  • KIF, Square
  • NativeDriver, http://code.google.com/p/nativedriver/

22

22 fredag den 25. maj 12

slide-23
SLIDE 23

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
  • https://github.com/calabash/calabash-android
  • http://blog.lesspainful.com/
  • https://www.lesspainful.com/

23

23 fredag den 25. maj 12

slide-24
SLIDE 24

Making app testing less painful... Please contact us with any questions: contact@lesspainful.com karl@lesspainful.com - iOS jonas@lesspainful.com - Android http://www.lesspainful.com

Questions?

24 fredag den 25. maj 12