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
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
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
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
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
In our team case •Process in our team was Scrum. •Towards Automating acceptance testing in the future. •First step for Automation to introduce calabash
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
Not Changing Testcase •Trasition between pages •Main scenario for app. ‣Applying job offer ‣Searching by their condition ‣Add some offer to favorite list
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.
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.
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.
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.