$30 off During Our Annual Pro Sale. View Details »

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. Introduction to
    Calabash
    -improve your app architecture-

    View Slide

  2. Self-Intro
    •Chiaki Yokoo
    •at Recruit Technologies Co.,Ltd
    •Java(Android/Spring Boot)

    View Slide

  3. Today’s target
    •For beginners
    •People who don't write a test code.
    •People who don’t know how to improve
    architecture

    View Slide

  4. Agenda
    •About Calabash
    •How to write Calabash Code
    •In our case
    •Next step in the future

    View Slide

  5. About Calabash

    View Slide

  6. Calabash

    View Slide

  7. What about Calabash
    •Automated Testing Framework
    •Support Android and iOS
    •Support
    •can write like pure English called as
    Gherkin

    View Slide

  8. start Testing
    •You will modify two types of file.
    •.feature and step definitions
    file(ruby file)

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  12. Customizing
    • don’t worry about no steps that you want
    • can customize by using adb shell and Ruby

    View Slide

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

    View Slide

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

    View Slide

  15. In Our Case

    View Slide

  16. In our team case
    •Process in our team was Scrum.
    •Towards Automating acceptance testing
    in the future.
    •First step for Automation to introduce
    calabash

    View Slide

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

    View Slide

  18. Not Changing Testcase
    •Trasition between pages
    •Main scenario for app.
    ‣Applying job offer
    ‣Searching by their condition
    ‣Add some offer to favorite list

    View Slide

  19. Useful? Useless?
    Is it really useful…?

    View Slide

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

    View Slide

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

    View Slide

  22. Why improving architecture
    •If Test outside from code,it doesn’t
    depends on inner structure.
    Code
    Test
    Outside from code
    Unit Test
    App

    View Slide

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

    View Slide

  24. Summary

    View Slide

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

    View Slide

  26. Thank you for listening

    View Slide