Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Test automation


Published on

Test automation

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Test automation

  1. 1. Test Automation Using Cucumber and Calabash Xavier Yin 201/01/15
  2. 2. Outline  Introduction – Testing – Comparisons – Automation Testing Tool – Implement Steps  Environments – Ruby Installer – Devkit – Rails and Calabash-Android  Implements
  3. 3. Testing  Unit Testing – A software testing method by which individual units of source code  Integration Testing – A phase in software testing in which individual software modules are combined and tested as a group.  Regression Testing – A type of software testing that seeks to uncover new software bugs, or regressions
  4. 4. Manual and Automatic Manual Automatic High Effort and Cost requirements Low Effort and Cost requirements Time consuming Quick, allows test engineers to focus on functional areas Tests are not reusable Complete reusability based on type of implementation Mostly used for integration tests Can be used for any tests including load, sanity, system, etc Risk of human errors Script validates all areas once tested
  5. 5. Automation Testing Tool
  6. 6. Cucumber  A framework for writing software specifications  A tool for executing those specifications – Specifications are written in a readable language that is close to natural language. – Scenarios – user behavior driven tests – Steps – combine mobile operation and logic
  7. 7. Calabash  A tool – Predefined and custom steps – Reuse of tests across platform possible – For BDD-style acceptance testing  Run on physical devices or simulators  Support for webview  Ruby based  Cross-platform mobile testing tool – Cucumber: Android or IOS testing
  8. 8. Implement Steps Describe behavior in plain text Write a step definition in Ruby Run and watch it fail Run and watch it success Write code to make the step pass
  9. 9. Describe behavior in plain text  Feature – Descriptions  Scenario – Descriptions – Preconditions – Steps  Given  When  And  But  Then
  10. 10. Write a step definition in Ruby
  11. 11. Run and watch it fail  Fail – Red light and notifications
  12. 12. Write code to make the step pass Modify
  13. 13. Observer Results and Reports  Success – Green light like a cuke
  14. 14. Ruby Installer  Download RubyInstaller  Install – Check the option named “Add Ruby executables to your PATH” – Test it  Using “ruby –v” on cmd window – Observer  Show “ruby 2.0.0p353 (2013-11-22) [x64-mingw32]”is success.
  15. 15. DevKit  Download DevKit in a folder which you want to save – For Instance: D:DevKit  Navigate the folder on cmd window – Using “ruby de.rb init”  Check the file named config.yml is existent  Using “ruby dk.rb install”on cmd window
  16. 16. Rails and Calabash-Android  Using “gem update --system” and “gem install rails --no-ri --no- rdoc”on cmd window  Install Rails – Using “gem install rails --no-ri --no-rdoc”  Test it – Using “rails –v” on cmd window  It is successful to show “Rails 4.0.2”  Using “gem install calabash-android” on cmd window
  17. 17. Prepare Test Cases  Create a Cucumber skeleton in your Android project – Using “calabash-android gen” on cmd window  Create a *.feature file – That is a test case file including features, function descriptions or scenarios.
  18. 18. Given, When and Then  Given – your preconditions  When – describe the key action  Then – observe outcomes or an assertion  And, But – Using it if you have several givens, whens or thens.
  19. 19. Basic API  Find out a view - Query(uiquery, *args) – You can find views and other application objects, and make assertions about them or extract data from them, and query returns an array of its results.  For instance:
  20. 20. Basic API  Touch - touch(uiquery, options={}) – Touches a view found by performing the query uiquery.  For instance:
  21. 21. Basic API  Entering text - enter_text(uiquery, text, options={}) – Taps the first element returned by uiquery, then enters text into the view.  For instance:
  22. 22. Basic API  Tap - tap_when_element_exists(uiquery, options={}) – Waits for an element and taps it when it appears on screen. It raises an exception if the element doesn't appear within the timeout.  For instance:
  23. 23. Basic API  Scroll - scroll_down and scroll_up – Scrolls the first instance of 'android.widget.ScrollView' either downwards or upwards.  For instance:
  24. 24. Run your APP and generate a report  Using “calabash-android run apkName.apk –format html –out reports.html” on cmd window