introducing
play

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


  1. 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

  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 fredag den 25. maj 12 2

  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 fredag den 25. maj 12 3

  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 fredag den 25. maj 12 4

  5. The functional testing story for mobile apps • 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 5

  6. Automated functional testing desiderata • 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 fredag den 25. maj 12 6

  7. fredag den 25. maj 12 7

  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/ fredag den 25. maj 12 8

  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: ... fredag den 25. maj 12 9

  10. Step Definitions • Make the cucumber tests “come alive” • Written in ordinary programming languages • Mostly Ruby (but cucumber-jvm: Java, Clojure,...) Feature Step definitions When /^I touch the Add User button$/ do Scenario: Add test user btn_txt = 'Add user' When I touch the Add User button touch("button text:#{btn_txt}") ... end fredag den 25. maj 12 10

  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... fredag den 25. maj 12 11

  12. fredag den 25. maj 12 12

  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 fredag den 25. maj 12 13

  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 fredag den 25. maj 12 14

  15. fredag den 25. maj 12 15

  16. fredag den 25. maj 12 16

  17. Calabash iOS: more detail 17 fredag den 25. maj 12 17

  18. Architecture iOS features iOS App -------------------- Cucumber Calabash library (ruby api) Test report (cucumber) fredag den 25. maj 12 18

  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 fredag den 25. maj 12 19

  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 fredag den 25. maj 12 20

  21. Demo: - Calabash iOS - LessPainful Device Cloud 21 fredag den 25. maj 12 21

  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 fredag den 25. maj 12 22

  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 fredag den 25. maj 12 23

  24. Questions? 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 fredag den 25. maj 12 24

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend