SlideShare una empresa de Scribd logo
1 de 18
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

Más contenido relacionado

La actualidad más candente

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 2014Gil Irizarry
 
Production Ready Web Services with Dropwizard
Production Ready Web Services with DropwizardProduction Ready Web Services with Dropwizard
Production Ready Web Services with Dropwizardsullis
 
React Native custom components
React Native custom componentsReact Native custom components
React Native custom componentsJeremy 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 AndroidSittiphol Phanvilai
 
2011 a grape odyssey
2011   a grape odyssey2011   a grape odyssey
2011 a grape odysseyMike 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 2011sullis
 
Training Session 2 - Day 2
Training Session 2 - Day 2Training Session 2 - Day 2
Training Session 2 - Day 2Vivek 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 AccessibilityAscii 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 PerspectiveVin 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 Javascriptjoshcjensen
 
Connect.js - Exploring React.Native
Connect.js - Exploring React.NativeConnect.js - Exploring React.Native
Connect.js - Exploring React.Nativejoshcjensen
 
A tour of React Native
A tour of React NativeA tour of React Native
A tour of React NativeTadeu 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 @ValenciaJSMarcel 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 DevelopmentDevathon
 
Design Patterns in XCUITest
Design Patterns in XCUITestDesign Patterns in XCUITest
Design Patterns in XCUITestVivian Liu
 

La actualidad más candente (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 a 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 testingeGo 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 2014Jean-Loup Yu
 
Calabash automated test
Calabash automated testCalabash automated test
Calabash automated testkellinreaver
 
BDD / cucumber /Capybara
BDD / cucumber /CapybaraBDD / cucumber /Capybara
BDD / cucumber /CapybaraShraddhaSF
 
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 testingGeert 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 OverlordsSteve Malsam
 
Intro to Continuous Integration at SoundCloud
Intro to Continuous Integration at SoundCloudIntro to Continuous Integration at SoundCloud
Intro to Continuous Integration at SoundCloudgarriguv
 
Calabash-android
Calabash-androidCalabash-android
Calabash-androidAdnan8990
 
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 LazuliRebecca Eloise Hogg
 
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 RailsJim Jeffers
 
Behaviour driven infrastructure
Behaviour driven infrastructureBehaviour driven infrastructure
Behaviour driven infrastructureLindsay Holmwood
 
Telerik AppBuilder Presentation for TelerikNEXT Conference
Telerik AppBuilder Presentation for TelerikNEXT ConferenceTelerik AppBuilder Presentation for TelerikNEXT Conference
Telerik AppBuilder Presentation for TelerikNEXT ConferenceJen Looper
 
Progressive Web Application by Citytech
Progressive Web Application by CitytechProgressive Web Application by Citytech
Progressive Web Application by CitytechRitwik 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 HighlightsRomain Guy
 
Android the Agile way
Android the Agile wayAndroid the Agile way
Android the Agile wayAshwin Raghav
 

Similar a 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
 

Último

Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 

Último (20)

Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 

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