SlideShare a Scribd company logo
CALABASH +
CUCUMBER
ANDROID TESTING IN-ACTION
+
M.Wildan Garviandi
https://github.com/WildanGarviandi
ALL YOU
NEED IS
HOW TO TEST ON LOCAL DEVICE?
https://github.com/calabash/calabash-android
CALABASH IS FOR
BEHAVIOUR-
DRIVEN
DEVELOPMENT
Someone on Some Website
M.Wildan Garviandi
https://github.com/WildanGarviandi
WHAT THE HELL IS CALABASH?
CALABASH
▸ In short, Calabash is a test automation framework that
enables mobile developers and pretty much anyone
without coding skills to create and execute automated
acceptance tests for Android and iOS apps. Calabash
works by enabling automatic UI interactions within an
application such as pressing buttons, inputting text,
validating responses, etc. While this is a great first step in
automated UI acceptance test automation, the real
benefits can be gained when Calabash tests are executed
on real mobile devices. This is very easy and Calabash
tests can be configured to run on hundreds of different
Android and iOS devices, providing real-time feedback
and validation across many different form factors, OS
versions, OEM customizations and hardware specs.
BDD ?
SHORT THINGS ABOUT BDD
▸ Behavior driven development (BDD) is a modern quality assurance technique which aims to reduce TTM and enhance quality for
mobile and non-mobile apps for iOS and Android. In the past we used the terms Test Driven Development (TDD) or Extreme
Programming (XP) which aimed toward the same goal of developing your module in parallel with testing it in a rapid way.
Behavior Driven Development follows outside-in development, in which the application code is written after its externalities have
been defined. It’s conceptually similar to Test Driven Development (and is in fact based on it), but takes it one step further; instead
of creating tests that describe the shape of APIs, application behaviors are specified. Recently, and especially in mobile where a
need to shift quality activities earlier in the development lifecycle to meet continuous integration goals, BDD has become a standard
method of agile software development. Cucumber and Calabash tools are using Ruby as their development language (also Java and
ObjectiveC are supported). Calabash is a mobile open source solution which is an extension of Cucumber. Typically the flow of
developing a Cucumber or a Calabash test case will consist of the below steps as shown in Figure 1. The advantage of such
technology is the ease of writing software readable specification together with the development of your tests for high quality. In a
simple statement developers iteratively translate use cases into test code during app development
SO BDD IS “THE WAY YOU TEST THE
FUNCTIONAL YOUR APP”
CUCUMBER SCRIPT
▸ Here’s the example for cucumber script
for create scenario testing in human
level (i mean it :) )
▸ If anyone had experience with ruby this
script already used by ruby on rails
testing method with R spec framework
▸ This cucumber will call and parsed on
real ruby files helper with regex method
CUCUMBER
+
BASH NEED BOTH
M.Wildan Garviandi
https://github.com/WildanGarviandi
▸ Rules cucumber script
▸ For advance use please check
CUCUMBER
CUCUMBER SCRIPT
Ex. Touch something
Then I touch “login” button
Then = Represent do this line after doing something for action in first time you can use “Given” with initial
condition ex. (Given I am on “login” page) while check if “login” page really present on screen
touch = Represent the action of this part of scenario it can be “fill”, “swipe”, “wait”, “scroll”, “rotate”, etc.
login = Represent the target for the action you can get this id from query all element in screen
button = Represent the element to test by the action
* Make sure create make sense action for test the scenario because you can use this for random purpose
https://github.com/calabash/calabash-ios/wiki/02-Predefined-steps
M.Wildan Garviandi
https://github.com/WildanGarviandi
CUCUMBER PRE-DEFINED STEP
Standard Pre-Defined case is :
Screenshots :
You can take a screenshot
Then take picture
Touching button :
Buttons (Button) by accessibility label
Then I touch the "login" button
Input text :
Entering text by accessibility label:
Then I enter "text to write" into the "accessibility label" input field
Waiting :
Waiting for text, or a view with a certain accessibilityLabel
Then I wait to see "text or label"
FEATURE FILES
.FEATURE
Feature: Login feature
@loginpage
Scenario: As a valid user I can log into my app
Given I am on the Login Page
Then I touch "countrycode text"
Then I touch "search text"
Then I fill in "search text" with "Indonesia"
Then I touch "search result"
Then I touch "phonenumber field"
Then I fill in "phonenumber field" with "81615468105"
Then I touch "password field"
Then I enter in "password field" with "rahasia"
And I touch "login button"
Then I checking the "update dialog"
} Scenario of functionality
of your app
CALABASH
CALABASH_STEPS.RB
# Given I am on the Login Page
Given(/^I am on the Login Page$/) do
page(LoginPage).on_login_page
end
# Then I touch "countrycode text"
Then(/^I touch ("countrycode text")$/) do |arg1|
page(LoginPage).touch_country_code
end
# Then I touch "search text"
Then(/^I touch ("search text")$/) do |arg1|
page(LoginPage).touch_search_text
end
M.Wildan Garviandi
https://github.com/WildanGarviandi
ACCESSING THE ID OF VIEW PRESENT
CUCUMBER
Wildan-Garviandi:~/tmp/android$ calabash-android console login.apk
irb(main):001:0> reinstall_apps
=> nil
irb(main):002:0> start_test_server_in_background
=> nil
To get the id of view of present view you can do it via terminal
The result from query all views is :
irb(main):001:0> query("button")
[{"id"=>"login_button",
"enabled"=>true,
"contentDescription"=>nil,
"text"=>"Login",
"qualified_class"=>"android.widget.Button",
"frame"=>{"y"=>322, "height"=>73, "width"=>84, "x"=>135},
"description"=>"android.widget.Button@40584908",
"class"=>"Button"},
{"id"=>"login_button_slow",
"enabled"=>true,
"contentDescription"=>nil,
"text"=>"Login (slow)",
"qualified_class"=>"android.widget.Button",
"frame"=>{"y"=>322, "height"=>73, "width"=>143, "x"=>234},
"description"=>"android.widget.Button@40585390",
"class"=>"Button"}]
DEFINE THE CUCUMBER SCENARIO
▸ calabash_steps.rb
RUBY
You’ll find more than 2 ruby file first one is :
This is class for parsing cucumber .feature files into ruby action
ex.require 'calabash-android/calabash_steps'
# Given I am on the Login Page
Given(/^I am on the Login Page$/) do
page(LoginPage).on_login_page
end
# Then I touch "countrycode text"
Then(/^I touch ("countrycode text")$/) do
page(LoginPage).touch_country_code
end
M.Wildan Garviandi
https://github.com/WildanGarviandi
DEFINE THE CUCUMBER SCENARIO
▸ <feature_name>page.rb
RUBY
The second one is :
This is class is action for all test process with Calabash ruby API more detail on :
ex.
require 'calabash-android/abase'
class LoginPage < Calabash::ABase
def trait
"* text:'Login Page'"
end
@@editTextSearchCountryCode = "* id:'search_et'"
def touch_search_text
touch(@@editTextSearchCountryCode)
end
def insert_phone_number
enter_text(@@phoneNumber, @@phoneNumberToTest)
end
https://github.com/calabash/calabash-ios/wiki/Calabash-iOS-Ruby-API
M.Wildan Garviandi
https://github.com/WildanGarviandi
DEFINE THE CUCUMBER SCENARIO
TEXT
require 'calabash-android/abase'
class LoginPage < Calabash::ABase
def trait
"* text:'Login Page'"
end
@@editTextSearchCountryCode = "* id:’search_et'"
@@phoneNumber = "* marked:'Input your Mobile Number’"
@@phoneNumberToTest = 81615468105
def touch_search_text
touch(@@editTextSearchCountryCode)
end
def insert_phone_number
enter_text(@@phoneNumber, @@phoneNumberToTest)
end
<— this where the id from query used for
}
M.Wildan Garviandi
https://github.com/WildanGarviandi
SO ALL YOU NEED
ONLY …▸ <feature_name>.feature on /features
▸ calabash_steps.rb on /features/step_definitions
▸ <feature_name>Page.rb on
/features/support/<feature_name>
▸ And most importent file for running all test at Jenkins is
run_android_feature
M.Wildan Garviandi
https://github.com/WildanGarviandi
DEMO
TIME
THANK YOU
GRACIAS
ありがとうございます
감사합니다
감사합니다
감사합니다
감사합니다
감사합니다
M.Wildan Garviandi
https://github.com/WildanGarviandi

More Related Content

What's hot

Xam expertday
Xam expertdayXam expertday
Xam expertday
Codrina Merigo
 
Make Cross-platform Mobile Apps Quickly - SIGGRAPH 2014
Make Cross-platform Mobile Apps Quickly - SIGGRAPH 2014Make Cross-platform Mobile Apps Quickly - SIGGRAPH 2014
Make Cross-platform Mobile Apps Quickly - SIGGRAPH 2014
Gil Irizarry
 
Production Ready Web Services with Dropwizard
Production Ready Web Services with DropwizardProduction Ready Web Services with Dropwizard
Production Ready Web Services with Dropwizard
sullis
 
React Native custom components
React Native custom componentsReact Native custom components
React Native custom components
Jeremy Grancher
 
I/O Rewind 215: What's new in Android
I/O Rewind 215: What's new in AndroidI/O Rewind 215: What's new in Android
I/O Rewind 215: What's new in Android
Sittiphol Phanvilai
 
2011 a grape odyssey
2011   a grape odyssey2011   a grape odyssey
2011 a grape odyssey
Mike Hagedorn
 
Android 3.1 - Portland Code Camp 2011
Android 3.1 - Portland Code Camp 2011Android 3.1 - Portland Code Camp 2011
Android 3.1 - Portland Code Camp 2011
sullis
 
Training Session 2 - Day 2
Training Session 2 - Day 2Training Session 2 - Day 2
Training Session 2 - Day 2
Vivek Bhusal
 
React Nativeの光と闇
React Nativeの光と闇React Nativeの光と闇
React Nativeの光と闇
Yukiya Nakagawa
 
One Page to Test Them All!
One Page to Test Them All!One Page to Test Them All!
One Page to Test Them All!
Thoughtworks
 
Android Accessibility
Android AccessibilityAndroid Accessibility
Android Accessibility
Ascii Huang
 
React 101 by Anatoliy Sieryi
React 101 by Anatoliy Sieryi React 101 by Anatoliy Sieryi
React 101 by Anatoliy Sieryi
Binary Studio
 
Android Wear: A Developer's Perspective
Android Wear: A Developer's PerspectiveAndroid Wear: A Developer's Perspective
Android Wear: A Developer's Perspective
Vin Lim
 
Connect.js 2015 - Building Native Mobile Applications with Javascript
Connect.js 2015 - Building Native Mobile Applications with JavascriptConnect.js 2015 - Building Native Mobile Applications with Javascript
Connect.js 2015 - Building Native Mobile Applications with Javascript
joshcjensen
 
Connect.js - Exploring React.Native
Connect.js - Exploring React.NativeConnect.js - Exploring React.Native
Connect.js - Exploring React.Native
joshcjensen
 
How to React Native
How to React NativeHow to React Native
How to React Native
Dmitry Ulyanov
 
A tour of React Native
A tour of React NativeA tour of React Native
A tour of React Native
Tadeu Zagallo
 
Lo mejor y peor de React Native @ValenciaJS
Lo mejor y peor de React Native @ValenciaJSLo mejor y peor de React Native @ValenciaJS
Lo mejor y peor de React Native @ValenciaJS
Marcel Kalveram
 
How native is React Native? | React Native vs Native App Development
How native is React Native? | React Native vs Native App DevelopmentHow native is React Native? | React Native vs Native App Development
How native is React Native? | React Native vs Native App Development
Devathon
 
Design Patterns in XCUITest
Design Patterns in XCUITestDesign Patterns in XCUITest
Design Patterns in XCUITest
Vivian Liu
 

What's hot (20)

Xam expertday
Xam expertdayXam expertday
Xam expertday
 
Make Cross-platform Mobile Apps Quickly - SIGGRAPH 2014
Make Cross-platform Mobile Apps Quickly - SIGGRAPH 2014Make Cross-platform Mobile Apps Quickly - SIGGRAPH 2014
Make Cross-platform Mobile Apps Quickly - SIGGRAPH 2014
 
Production Ready Web Services with Dropwizard
Production Ready Web Services with DropwizardProduction Ready Web Services with Dropwizard
Production Ready Web Services with Dropwizard
 
React Native custom components
React Native custom componentsReact Native custom components
React Native custom components
 
I/O Rewind 215: What's new in Android
I/O Rewind 215: What's new in AndroidI/O Rewind 215: What's new in Android
I/O Rewind 215: What's new in Android
 
2011 a grape odyssey
2011   a grape odyssey2011   a grape odyssey
2011 a grape odyssey
 
Android 3.1 - Portland Code Camp 2011
Android 3.1 - Portland Code Camp 2011Android 3.1 - Portland Code Camp 2011
Android 3.1 - Portland Code Camp 2011
 
Training Session 2 - Day 2
Training Session 2 - Day 2Training Session 2 - Day 2
Training Session 2 - Day 2
 
React Nativeの光と闇
React Nativeの光と闇React Nativeの光と闇
React Nativeの光と闇
 
One Page to Test Them All!
One Page to Test Them All!One Page to Test Them All!
One Page to Test Them All!
 
Android Accessibility
Android AccessibilityAndroid Accessibility
Android Accessibility
 
React 101 by Anatoliy Sieryi
React 101 by Anatoliy Sieryi React 101 by Anatoliy Sieryi
React 101 by Anatoliy Sieryi
 
Android Wear: A Developer's Perspective
Android Wear: A Developer's PerspectiveAndroid Wear: A Developer's Perspective
Android Wear: A Developer's Perspective
 
Connect.js 2015 - Building Native Mobile Applications with Javascript
Connect.js 2015 - Building Native Mobile Applications with JavascriptConnect.js 2015 - Building Native Mobile Applications with Javascript
Connect.js 2015 - Building Native Mobile Applications with Javascript
 
Connect.js - Exploring React.Native
Connect.js - Exploring React.NativeConnect.js - Exploring React.Native
Connect.js - Exploring React.Native
 
How to React Native
How to React NativeHow to React Native
How to React Native
 
A tour of React Native
A tour of React NativeA tour of React Native
A tour of React Native
 
Lo mejor y peor de React Native @ValenciaJS
Lo mejor y peor de React Native @ValenciaJSLo mejor y peor de React Native @ValenciaJS
Lo mejor y peor de React Native @ValenciaJS
 
How native is React Native? | React Native vs Native App Development
How native is React Native? | React Native vs Native App DevelopmentHow native is React Native? | React Native vs Native App Development
How native is React Native? | React Native vs Native App Development
 
Design Patterns in XCUITest
Design Patterns in XCUITestDesign Patterns in XCUITest
Design Patterns in XCUITest
 

Similar to Android testing calabash

eGo meetup - Сalabash in mobile automated testing
eGo meetup - Сalabash in mobile automated testingeGo meetup - Сalabash in mobile automated testing
eGo meetup - Сalabash in mobile automated testing
eGo Creative Media Solutions
 
Green Light for the Apps with Calaba.sh - DroidCon Paris 2014
Green Light for the Apps with Calaba.sh - DroidCon Paris 2014Green Light for the Apps with Calaba.sh - DroidCon Paris 2014
Green Light for the Apps with Calaba.sh - DroidCon Paris 2014
Jean-Loup Yu
 
Calabash automated test
Calabash automated testCalabash automated test
Calabash automated test
kellinreaver
 
BDD / cucumber /Capybara
BDD / cucumber /CapybaraBDD / cucumber /Capybara
BDD / cucumber /Capybara
ShraddhaSF
 
Xamarin Test Cloud - from zero to hero in automated ui testing
Xamarin Test Cloud - from zero to hero in automated ui testingXamarin Test Cloud - from zero to hero in automated ui testing
Xamarin Test Cloud - from zero to hero in automated ui testing
Geert van der Cruijsen
 
I, For One, Welcome Our New Robot Overlords
I, For One, Welcome Our New Robot OverlordsI, For One, Welcome Our New Robot Overlords
I, For One, Welcome Our New Robot Overlords
Steve Malsam
 
Intro to Continuous Integration at SoundCloud
Intro to Continuous Integration at SoundCloudIntro to Continuous Integration at SoundCloud
Intro to Continuous Integration at SoundCloud
garriguv
 
Calabash-android
Calabash-androidCalabash-android
Calabash-android
Adnan8990
 
Different Android Test Automation Frameworks - What Works You the Best?
Different Android Test Automation Frameworks - What Works You the Best?Different Android Test Automation Frameworks - What Works You the Best?
Different Android Test Automation Frameworks - What Works You the Best?
Bitbar
 
Getting Started with Test Automation: Introduction to Cucumber with Lapis Lazuli
Getting Started with Test Automation: Introduction to Cucumber with Lapis LazuliGetting Started with Test Automation: Introduction to Cucumber with Lapis Lazuli
Getting Started with Test Automation: Introduction to Cucumber with Lapis Lazuli
Rebecca Eloise Hogg
 
Calabash for iPhone apps
Calabash for iPhone appsCalabash for iPhone apps
Calabash for iPhone apps
Chathura palihakkara
 
From Idea to App (or “How we roll at Small Town Heroes”)
From Idea to App (or “How we roll at Small Town Heroes”)From Idea to App (or “How we roll at Small Town Heroes”)
From Idea to App (or “How we roll at Small Town Heroes”)
Bramus Van Damme
 
Building Mobile Friendly APIs in Rails
Building Mobile Friendly APIs in RailsBuilding Mobile Friendly APIs in Rails
Building Mobile Friendly APIs in Rails
Jim Jeffers
 
Behaviour driven infrastructure
Behaviour driven infrastructureBehaviour driven infrastructure
Behaviour driven infrastructure
Lindsay Holmwood
 
iOS and Android apps automation
iOS and Android apps automationiOS and Android apps automation
iOS and Android apps automation
Sridhar Ramakrishnan
 
Telerik AppBuilder Presentation for TelerikNEXT Conference
Telerik AppBuilder Presentation for TelerikNEXT ConferenceTelerik AppBuilder Presentation for TelerikNEXT Conference
Telerik AppBuilder Presentation for TelerikNEXT Conference
Jen Looper
 
Progressive Web Application by Citytech
Progressive Web Application by CitytechProgressive Web Application by Citytech
Progressive Web Application by Citytech
Ritwik Das
 
Connecting with the enterprise - The how and why of connecting to Enterprise ...
Connecting with the enterprise - The how and why of connecting to Enterprise ...Connecting with the enterprise - The how and why of connecting to Enterprise ...
Connecting with the enterprise - The how and why of connecting to Enterprise ...
Kevin Poorman
 
Google I/O 2011, Android Honeycomb Highlights
Google I/O 2011, Android Honeycomb HighlightsGoogle I/O 2011, Android Honeycomb Highlights
Google I/O 2011, Android Honeycomb Highlights
Romain Guy
 
Android the Agile way
Android the Agile wayAndroid the Agile way
Android the Agile way
Ashwin Raghav
 

Similar to Android testing calabash (20)

eGo meetup - Сalabash in mobile automated testing
eGo meetup - Сalabash in mobile automated testingeGo meetup - Сalabash in mobile automated testing
eGo meetup - Сalabash in mobile automated testing
 
Green Light for the Apps with Calaba.sh - DroidCon Paris 2014
Green Light for the Apps with Calaba.sh - DroidCon Paris 2014Green Light for the Apps with Calaba.sh - DroidCon Paris 2014
Green Light for the Apps with Calaba.sh - DroidCon Paris 2014
 
Calabash automated test
Calabash automated testCalabash automated test
Calabash automated test
 
BDD / cucumber /Capybara
BDD / cucumber /CapybaraBDD / cucumber /Capybara
BDD / cucumber /Capybara
 
Xamarin Test Cloud - from zero to hero in automated ui testing
Xamarin Test Cloud - from zero to hero in automated ui testingXamarin Test Cloud - from zero to hero in automated ui testing
Xamarin Test Cloud - from zero to hero in automated ui testing
 
I, For One, Welcome Our New Robot Overlords
I, For One, Welcome Our New Robot OverlordsI, For One, Welcome Our New Robot Overlords
I, For One, Welcome Our New Robot Overlords
 
Intro to Continuous Integration at SoundCloud
Intro to Continuous Integration at SoundCloudIntro to Continuous Integration at SoundCloud
Intro to Continuous Integration at SoundCloud
 
Calabash-android
Calabash-androidCalabash-android
Calabash-android
 
Different Android Test Automation Frameworks - What Works You the Best?
Different Android Test Automation Frameworks - What Works You the Best?Different Android Test Automation Frameworks - What Works You the Best?
Different Android Test Automation Frameworks - What Works You the Best?
 
Getting Started with Test Automation: Introduction to Cucumber with Lapis Lazuli
Getting Started with Test Automation: Introduction to Cucumber with Lapis LazuliGetting Started with Test Automation: Introduction to Cucumber with Lapis Lazuli
Getting Started with Test Automation: Introduction to Cucumber with Lapis Lazuli
 
Calabash for iPhone apps
Calabash for iPhone appsCalabash for iPhone apps
Calabash for iPhone apps
 
From Idea to App (or “How we roll at Small Town Heroes”)
From Idea to App (or “How we roll at Small Town Heroes”)From Idea to App (or “How we roll at Small Town Heroes”)
From Idea to App (or “How we roll at Small Town Heroes”)
 
Building Mobile Friendly APIs in Rails
Building Mobile Friendly APIs in RailsBuilding Mobile Friendly APIs in Rails
Building Mobile Friendly APIs in Rails
 
Behaviour driven infrastructure
Behaviour driven infrastructureBehaviour driven infrastructure
Behaviour driven infrastructure
 
iOS and Android apps automation
iOS and Android apps automationiOS and Android apps automation
iOS and Android apps automation
 
Telerik AppBuilder Presentation for TelerikNEXT Conference
Telerik AppBuilder Presentation for TelerikNEXT ConferenceTelerik AppBuilder Presentation for TelerikNEXT Conference
Telerik AppBuilder Presentation for TelerikNEXT Conference
 
Progressive Web Application by Citytech
Progressive Web Application by CitytechProgressive Web Application by Citytech
Progressive Web Application by Citytech
 
Connecting with the enterprise - The how and why of connecting to Enterprise ...
Connecting with the enterprise - The how and why of connecting to Enterprise ...Connecting with the enterprise - The how and why of connecting to Enterprise ...
Connecting with the enterprise - The how and why of connecting to Enterprise ...
 
Google I/O 2011, Android Honeycomb Highlights
Google I/O 2011, Android Honeycomb HighlightsGoogle I/O 2011, Android Honeycomb Highlights
Google I/O 2011, Android Honeycomb Highlights
 
Android the Agile way
Android the Agile wayAndroid the Agile way
Android the Agile way
 

Recently uploaded

National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
Quotidiano Piemontese
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
Aftab Hussain
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
Matthew Sinclair
 
“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”
Claudio Di Ciccio
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
mikeeftimakis1
 
20 Comprehensive Checklist of Designing and Developing a Website
20 Comprehensive Checklist of Designing and Developing a Website20 Comprehensive Checklist of Designing and Developing a Website
20 Comprehensive Checklist of Designing and Developing a Website
Pixlogix Infotech
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
SOFTTECHHUB
 
Large Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial ApplicationsLarge Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial Applications
Rohit Gautam
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
Neo4j
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
Neo4j
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
Neo4j
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Speck&Tech
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
innovationoecd
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
Daiki Mogmet Ito
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
James Anderson
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
Uni Systems S.M.S.A.
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 

Recently uploaded (20)

National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
 
“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
 
20 Comprehensive Checklist of Designing and Developing a Website
20 Comprehensive Checklist of Designing and Developing a Website20 Comprehensive Checklist of Designing and Developing a Website
20 Comprehensive Checklist of Designing and Developing a Website
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
 
Large Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial ApplicationsLarge Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial Applications
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 

Android testing calabash

  • 1. CALABASH + CUCUMBER ANDROID TESTING IN-ACTION + M.Wildan Garviandi https://github.com/WildanGarviandi
  • 2. ALL YOU NEED IS HOW TO TEST ON LOCAL DEVICE? https://github.com/calabash/calabash-android
  • 3. CALABASH IS FOR BEHAVIOUR- DRIVEN DEVELOPMENT Someone on Some Website M.Wildan Garviandi https://github.com/WildanGarviandi
  • 4. WHAT THE HELL IS CALABASH? CALABASH ▸ In short, Calabash is a test automation framework that enables mobile developers and pretty much anyone without coding skills to create and execute automated acceptance tests for Android and iOS apps. Calabash works by enabling automatic UI interactions within an application such as pressing buttons, inputting text, validating responses, etc. While this is a great first step in automated UI acceptance test automation, the real benefits can be gained when Calabash tests are executed on real mobile devices. This is very easy and Calabash tests can be configured to run on hundreds of different Android and iOS devices, providing real-time feedback and validation across many different form factors, OS versions, OEM customizations and hardware specs.
  • 5. BDD ? SHORT THINGS ABOUT BDD ▸ Behavior driven development (BDD) is a modern quality assurance technique which aims to reduce TTM and enhance quality for mobile and non-mobile apps for iOS and Android. In the past we used the terms Test Driven Development (TDD) or Extreme Programming (XP) which aimed toward the same goal of developing your module in parallel with testing it in a rapid way. Behavior Driven Development follows outside-in development, in which the application code is written after its externalities have been defined. It’s conceptually similar to Test Driven Development (and is in fact based on it), but takes it one step further; instead of creating tests that describe the shape of APIs, application behaviors are specified. Recently, and especially in mobile where a need to shift quality activities earlier in the development lifecycle to meet continuous integration goals, BDD has become a standard method of agile software development. Cucumber and Calabash tools are using Ruby as their development language (also Java and ObjectiveC are supported). Calabash is a mobile open source solution which is an extension of Cucumber. Typically the flow of developing a Cucumber or a Calabash test case will consist of the below steps as shown in Figure 1. The advantage of such technology is the ease of writing software readable specification together with the development of your tests for high quality. In a simple statement developers iteratively translate use cases into test code during app development SO BDD IS “THE WAY YOU TEST THE FUNCTIONAL YOUR APP”
  • 6. CUCUMBER SCRIPT ▸ Here’s the example for cucumber script for create scenario testing in human level (i mean it :) ) ▸ If anyone had experience with ruby this script already used by ruby on rails testing method with R spec framework ▸ This cucumber will call and parsed on real ruby files helper with regex method CUCUMBER
  • 7. + BASH NEED BOTH M.Wildan Garviandi https://github.com/WildanGarviandi
  • 8. ▸ Rules cucumber script ▸ For advance use please check CUCUMBER CUCUMBER SCRIPT Ex. Touch something Then I touch “login” button Then = Represent do this line after doing something for action in first time you can use “Given” with initial condition ex. (Given I am on “login” page) while check if “login” page really present on screen touch = Represent the action of this part of scenario it can be “fill”, “swipe”, “wait”, “scroll”, “rotate”, etc. login = Represent the target for the action you can get this id from query all element in screen button = Represent the element to test by the action * Make sure create make sense action for test the scenario because you can use this for random purpose https://github.com/calabash/calabash-ios/wiki/02-Predefined-steps M.Wildan Garviandi https://github.com/WildanGarviandi
  • 9. CUCUMBER PRE-DEFINED STEP Standard Pre-Defined case is : Screenshots : You can take a screenshot Then take picture Touching button : Buttons (Button) by accessibility label Then I touch the "login" button Input text : Entering text by accessibility label: Then I enter "text to write" into the "accessibility label" input field Waiting : Waiting for text, or a view with a certain accessibilityLabel Then I wait to see "text or label"
  • 10. FEATURE FILES .FEATURE Feature: Login feature @loginpage Scenario: As a valid user I can log into my app Given I am on the Login Page Then I touch "countrycode text" Then I touch "search text" Then I fill in "search text" with "Indonesia" Then I touch "search result" Then I touch "phonenumber field" Then I fill in "phonenumber field" with "81615468105" Then I touch "password field" Then I enter in "password field" with "rahasia" And I touch "login button" Then I checking the "update dialog" } Scenario of functionality of your app
  • 11. CALABASH CALABASH_STEPS.RB # Given I am on the Login Page Given(/^I am on the Login Page$/) do page(LoginPage).on_login_page end # Then I touch "countrycode text" Then(/^I touch ("countrycode text")$/) do |arg1| page(LoginPage).touch_country_code end # Then I touch "search text" Then(/^I touch ("search text")$/) do |arg1| page(LoginPage).touch_search_text end M.Wildan Garviandi https://github.com/WildanGarviandi
  • 12. ACCESSING THE ID OF VIEW PRESENT CUCUMBER Wildan-Garviandi:~/tmp/android$ calabash-android console login.apk irb(main):001:0> reinstall_apps => nil irb(main):002:0> start_test_server_in_background => nil To get the id of view of present view you can do it via terminal The result from query all views is : irb(main):001:0> query("button") [{"id"=>"login_button", "enabled"=>true, "contentDescription"=>nil, "text"=>"Login", "qualified_class"=>"android.widget.Button", "frame"=>{"y"=>322, "height"=>73, "width"=>84, "x"=>135}, "description"=>"android.widget.Button@40584908", "class"=>"Button"}, {"id"=>"login_button_slow", "enabled"=>true, "contentDescription"=>nil, "text"=>"Login (slow)", "qualified_class"=>"android.widget.Button", "frame"=>{"y"=>322, "height"=>73, "width"=>143, "x"=>234}, "description"=>"android.widget.Button@40585390", "class"=>"Button"}]
  • 13. DEFINE THE CUCUMBER SCENARIO ▸ calabash_steps.rb RUBY You’ll find more than 2 ruby file first one is : This is class for parsing cucumber .feature files into ruby action ex.require 'calabash-android/calabash_steps' # Given I am on the Login Page Given(/^I am on the Login Page$/) do page(LoginPage).on_login_page end # Then I touch "countrycode text" Then(/^I touch ("countrycode text")$/) do page(LoginPage).touch_country_code end M.Wildan Garviandi https://github.com/WildanGarviandi
  • 14. DEFINE THE CUCUMBER SCENARIO ▸ <feature_name>page.rb RUBY The second one is : This is class is action for all test process with Calabash ruby API more detail on : ex. require 'calabash-android/abase' class LoginPage < Calabash::ABase def trait "* text:'Login Page'" end @@editTextSearchCountryCode = "* id:'search_et'" def touch_search_text touch(@@editTextSearchCountryCode) end def insert_phone_number enter_text(@@phoneNumber, @@phoneNumberToTest) end https://github.com/calabash/calabash-ios/wiki/Calabash-iOS-Ruby-API M.Wildan Garviandi https://github.com/WildanGarviandi
  • 15. DEFINE THE CUCUMBER SCENARIO TEXT require 'calabash-android/abase' class LoginPage < Calabash::ABase def trait "* text:'Login Page'" end @@editTextSearchCountryCode = "* id:’search_et'" @@phoneNumber = "* marked:'Input your Mobile Number’" @@phoneNumberToTest = 81615468105 def touch_search_text touch(@@editTextSearchCountryCode) end def insert_phone_number enter_text(@@phoneNumber, @@phoneNumberToTest) end <— this where the id from query used for } M.Wildan Garviandi https://github.com/WildanGarviandi
  • 16. SO ALL YOU NEED ONLY …▸ <feature_name>.feature on /features ▸ calabash_steps.rb on /features/step_definitions ▸ <feature_name>Page.rb on /features/support/<feature_name> ▸ And most importent file for running all test at Jenkins is run_android_feature M.Wildan Garviandi https://github.com/WildanGarviandi