Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Introduction to Calabash - Improve your app architecture -

chiiia12
July 25, 2017

Introduction to Calabash - Improve your app architecture -

I talked about Calabash in English at 'Tokyo Android Meetup #11'.
https://www.meetup.com/ja-JP/Tokyo-Android-Meetup/events/241811068/?from=ref

chiiia12

July 25, 2017
Tweet

More Decks by chiiia12

Other Decks in Technology

Transcript

  1. Today’s target •For beginners •People who don't write a test

    code. •People who don’t know how to improve architecture
  2. What about Calabash •Automated Testing Framework •Support Android and iOS

    •Support •can write like pure English called as Gherkin
  3. Feature : write test case •can write test case in

    feature file. Scenario: press add item button Given I see view text “hoge” When I press “add item” Then I see the text “next page” additem.feature
  4. Steps : detail of test case •can write gestures about

    steps of the test case. •can use regular expression Given(/^I enter the text freeword "([^"]*)"$/) do |free_word| step %{I enter text "#{free_word}" into field with id "text_free_word"} step %{I press the enter button} end
  5. predefinition steps Then /^I toggle checkbox number (\d+)$/ do |index|

    Given /^I set the date to "(\d\d-\d\d-\d\d\d\d)" on DatePicker with index "([^\"]*)"$/ do |date, index| Then /^I swipe right$/ FYI:https://github.com/calabash/calabash-android/blob/master/ruby-gem/ lib/calabash-android/canned_steps.md
  6. Customizing • don’t worry about no steps that you want

    • can customize by using adb shell and Ruby
  7. example for customizing •update app to newer version Given (/old

    version install $/) do |version| uninstall_apps install_app(ENV['TEST_APP_PATH']) apk_path = ENV['APP_PATH'] old_version_apk_path = apk_path.sub(/^(.*)-\d+\.\d+\.\d+- ([^\/]+\.apk)$/, '\1-'+version+'-\2') install_app(old_version_apk_path) end When (/version up$/) do update_app(ENV['APP_PATH']) end
  8. example for customizing •switch network to create no internet situation

    Given(/^switch network condition $/) do `adb shell am start -a android.intent.action.MAIN -n com.android.settings/.wifi.WifiSettings` `adb shell input keyevent 19 & adb shell input keyevent 19` `adb shell input keyevent 23` end
  9. In our team case •Process in our team was Scrum.

    •Towards Automating acceptance testing in the future. •First step for Automation to introduce calabash
  10. The first step for calabash •There are some risks. •Risk

    of changing the specification •Cost of maintenance the test code •So firstly choose test case that does not change for automation
  11. Not Changing Testcase •Trasition between pages •Main scenario for app.

    ‣Applying job offer ‣Searching by their condition ‣Add some offer to favorite list
  12. Trigger •Trigger is advice by a learned man. •Useful for

    complex architecture •For our team that didn’t have any test but have complex architecture, it is the first step to improve inner structure.
  13. Why improving architecture •For the team that don’t have any

    unit test,Changing its structure is risk. •to change its structure ,it needs test. •Writing unit testing for bad architecture, most test code may be useless.
  14. Why improving architecture •If Test outside from code,it doesn’t depends

    on inner structure. Code Test Outside from code Unit Test App
  15. Ideal steps 1.Writing test code about main scenario from outside.

    2.Measure coverage and which part of code are assert by test. 3.Improving structure the place where has test code.
  16. Summary •Introducing calabash •It may be question to be useful

    for product in term of quality assurance. •I found that it is one option how to improve architecture.