Today’s target
•For beginners
•People who don't write a test code.
•People who don’t know how to improve
architecture
Slide 4
Slide 4 text
Agenda
•About Calabash
•How to write Calabash Code
•In our case
•Next step in the future
Slide 5
Slide 5 text
About Calabash
Slide 6
Slide 6 text
Calabash
Slide 7
Slide 7 text
What about Calabash
•Automated Testing Framework
•Support Android and iOS
•Support
•can write like pure English called as
Gherkin
Slide 8
Slide 8 text
start Testing
•You will modify two types of file.
•.feature and step definitions
file(ruby file)
Slide 9
Slide 9 text
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
Slide 10
Slide 10 text
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
Slide 11
Slide 11 text
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
Slide 12
Slide 12 text
Customizing
• don’t worry about no steps that you want
• can customize by using adb shell and Ruby
Slide 13
Slide 13 text
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
Slide 14
Slide 14 text
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
Slide 15
Slide 15 text
In Our Case
Slide 16
Slide 16 text
In our team case
•Process in our team was Scrum.
•Towards Automating acceptance testing
in the future.
•First step for Automation to introduce
calabash
Slide 17
Slide 17 text
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
Slide 18
Slide 18 text
Not Changing Testcase
•Trasition between pages
•Main scenario for app.
‣Applying job offer
‣Searching by their condition
‣Add some offer to favorite list
Slide 19
Slide 19 text
Useful? Useless?
Is it really useful…?
Slide 20
Slide 20 text
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.
Slide 21
Slide 21 text
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.
Slide 22
Slide 22 text
Why improving architecture
•If Test outside from code,it doesn’t
depends on inner structure.
Code
Test
Outside from code
Unit Test
App
Slide 23
Slide 23 text
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.
Slide 24
Slide 24 text
Summary
Slide 25
Slide 25 text
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.