introducing calabash
play

Introducing Calabash automated functional testing for mobile native - PowerPoint PPT Presentation

Introducing Calabash automated functional testing for mobile native apps Karl Krukow, karl@lesspainful.com, LessPainful & Trifork QCon London 2012 1 fredag den 9. marts 12 About me 2 fredag den 9. marts 12 About me PhD, Computer


  1. Introducing Calabash automated functional testing for mobile native apps Karl Krukow, karl@lesspainful.com, LessPainful & Trifork QCon London 2012 1 fredag den 9. marts 12

  2. About me 2 fredag den 9. marts 12

  3. About me • PhD, Computer Science, University of Aarhus, 2006. 2 fredag den 9. marts 12

  4. About me • PhD, Computer Science, University of Aarhus, 2006. • Developer at Trifork for about 6 years mostly Java enterprise, last two years on iOS. 2 fredag den 9. marts 12

  5. About me • PhD, Computer Science, University of Aarhus, 2006. • Developer at Trifork for about 6 years mostly Java enterprise, last two years on iOS. • Spare-time Hickey & Clojure fan-boy! 2 fredag den 9. marts 12

  6. About me • PhD, Computer Science, University of Aarhus, 2006. • Developer at Trifork for about 6 years mostly Java enterprise, last two years on iOS. • Spare-time Hickey & Clojure fan-boy! • Co-authoring a book on Dart with Trifork CTO, Kresten Krab Thorup. 2 fredag den 9. marts 12

  7. About me • PhD, Computer Science, University of Aarhus, 2006. • Developer at Trifork for about 6 years mostly Java enterprise, last two years on iOS. • Spare-time Hickey & Clojure fan-boy! • Co-authoring a book on Dart with Trifork CTO, Kresten Krab Thorup. • Co-owner, iOS responsible at 2 fredag den 9. marts 12

  8. Agenda 3 fredag den 9. marts 12

  9. Agenda • Automated functional testing for native mobile • Some benefits as well as common problems • Some desirable properties for a functional testing tool 3 fredag den 9. marts 12

  10. Agenda • Automated functional testing for native mobile • Some benefits as well as common problems • Some desirable properties for a functional testing tool • Introduce Calabash • Focus on iOS 3 fredag den 9. marts 12

  11. Agenda • Automated functional testing for native mobile • Some benefits as well as common problems • Some desirable properties for a functional testing tool • Introduce Calabash • Focus on iOS • LessPainful: test service and device cloud 3 fredag den 9. marts 12

  12. Agenda • Automated functional testing for native mobile • Some benefits as well as common problems • Some desirable properties for a functional testing tool • Introduce Calabash • Focus on iOS • LessPainful: test service and device cloud • Demo! 3 fredag den 9. marts 12

  13. Functional testing 4 fredag den 9. marts 12

  14. Functional testing • Functional and Acceptance tests • Actual app, as opposed to an isolated component • Often based on use-cases written in natural (domain) language • Visual appearance of app screens matter! (Design guidelines, etc) • As realistic an environment as practically possible 4 fredag den 9. marts 12

  15. Functional testing • Functional and Acceptance tests • Actual app, as opposed to an isolated component • Often based on use-cases written in natural (domain) language • Visual appearance of app screens matter! (Design guidelines, etc) • As realistic an environment as practically possible • For mobile apps, in particular • often a manual process: repetitive, expensive • Many devices, screens, OS versions, languages 4 fredag den 9. marts 12

  16. Why automate? • Save time and effort. Less tedium of repetitive testing with each iteration. • Higher-quality before app goes to QA and production • higher test coverage with fewer resources • formalizes test procedure • Less likely to have regressions. • Faster feedback for developers. 5 fredag den 9. marts 12

  17. Some problems... 6 fredag den 9. marts 12

  18. Some problems... • Resources : Automated test suite is an entire code base that must be developed and maintained? • When app changes, test must often change (often, they are deleted instead!). • Accuracy - Tests may not be able to express what is wanted? (too precise or too loose) 6 fredag den 9. marts 12

  19. Some problems... • Resources : Automated test suite is an entire code base that must be developed and maintained? • When app changes, test must often change (often, they are deleted instead!). • Accuracy - Tests may not be able to express what is wanted? (too precise or too loose) • Completeness : Reduces, but does not eliminate need for manual testing. 6 fredag den 9. marts 12

  20. Tool Desiderata (IMO, hope you agree) 7 fredag den 9. marts 12

  21. Tool Desiderata (IMO, hope you agree) • 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. 7 fredag den 9. marts 12

  22. Cucumber and Calabash fredag den 9. marts 12

  23. • Cucumber is a tool for describing and executing specifications of software • 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 9. marts 12

  24. 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 9. marts 12

  25. 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 9. marts 12

  26. 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 9. marts 12

  27. 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 9. marts 12

  28. 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 9. marts 12

  29. 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 9. marts 12

  30. Step Definitions • Make the cucumber tests “come alive” • Written in ordinary programming languages • Mostly Ruby (but cucumber-jvm: Java, Clojure,...) Feature Step definitions fredag den 9. marts 12

  31. Step Definitions • Make the cucumber tests “come alive” • Written in ordinary programming languages • Mostly Ruby (but cucumber-jvm: Java, Clojure,...) Feature Step definitions Scenario: Add test user When I touch the Add User button ... fredag den 9. marts 12

  32. 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 9. marts 12

  33. Execution fredag den 9. marts 12

  34. Execution • Executing a test produces a test report • for each step, did it succeed or not • exception/error message if present fredag den 9. marts 12

  35. Execution • Executing a test produces a test report • for each step, did it succeed or not • exception/error message if present • Flexible output formats • Machine readable (XML, JSON,...) • Human readable, console fredag den 9. marts 12

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