green light for the apps with calaba.sh - droidcon paris 2014
DESCRIPTION
Talk @DroidCon Paris - 23rd September 2014 How Meetic Mobile App Team is using Calaba.sh to deliver better quality software.TRANSCRIPT
![Page 1: Green Light for the Apps with Calaba.sh - DroidCon Paris 2014](https://reader033.vdocuments.us/reader033/viewer/2022060121/559452b01a28abd94f8b46dc/html5/thumbnails/1.jpg)
Green Light for the Apps!
Using Calaba.sh @Meetic
DroidCon Paris September 23rd 2014
Cédric Creusot Jean-Loup Yu
![Page 2: Green Light for the Apps with Calaba.sh - DroidCon Paris 2014](https://reader033.vdocuments.us/reader033/viewer/2022060121/559452b01a28abd94f8b46dc/html5/thumbnails/2.jpg)
About us
Cédric Creusot
Android Developer
Meetic HQ
@Calimeraw
Jean-Loup Yu
Head of Mobile Development
Meetic HQ
@djelmen
![Page 3: Green Light for the Apps with Calaba.sh - DroidCon Paris 2014](https://reader033.vdocuments.us/reader033/viewer/2022060121/559452b01a28abd94f8b46dc/html5/thumbnails/3.jpg)
Agenda
About Meetic
Mobile @Meetic
Green light to submit
Why Calaba.sh?
Hands on
Experience Sharing
![Page 4: Green Light for the Apps with Calaba.sh - DroidCon Paris 2014](https://reader033.vdocuments.us/reader033/viewer/2022060121/559452b01a28abd94f8b46dc/html5/thumbnails/4.jpg)
About Meetic The French Success Story
![Page 5: Green Light for the Apps with Calaba.sh - DroidCon Paris 2014](https://reader033.vdocuments.us/reader033/viewer/2022060121/559452b01a28abd94f8b46dc/html5/thumbnails/5.jpg)
The Success Story
founded by Marc Simoncini
of dating service in Europe
of unique visitors / month
countries covered by Meetic Service
events organized by Meetic
employees
2001
#1
7 millions
17
>1000
380
![Page 6: Green Light for the Apps with Calaba.sh - DroidCon Paris 2014](https://reader033.vdocuments.us/reader033/viewer/2022060121/559452b01a28abd94f8b46dc/html5/thumbnails/6.jpg)
Mobile @Meetic Scaling in 2014
![Page 7: Green Light for the Apps with Calaba.sh - DroidCon Paris 2014](https://reader033.vdocuments.us/reader033/viewer/2022060121/559452b01a28abd94f8b46dc/html5/thumbnails/7.jpg)
Mobile Apps Team – start of 2014
Tech
Product
Design
4
2
1
![Page 8: Green Light for the Apps with Calaba.sh - DroidCon Paris 2014](https://reader033.vdocuments.us/reader033/viewer/2022060121/559452b01a28abd94f8b46dc/html5/thumbnails/8.jpg)
Mobile Apps Team - now
Tech
Product
Design
14
3
3
![Page 9: Green Light for the Apps with Calaba.sh - DroidCon Paris 2014](https://reader033.vdocuments.us/reader033/viewer/2022060121/559452b01a28abd94f8b46dc/html5/thumbnails/9.jpg)
Mobile Apps Team Scope
Android
iOS
Windows
API – Web Services
![Page 10: Green Light for the Apps with Calaba.sh - DroidCon Paris 2014](https://reader033.vdocuments.us/reader033/viewer/2022060121/559452b01a28abd94f8b46dc/html5/thumbnails/10.jpg)
Mobile Team Organization
One single open space
Cross functional Team
![Page 11: Green Light for the Apps with Calaba.sh - DroidCon Paris 2014](https://reader033.vdocuments.us/reader033/viewer/2022060121/559452b01a28abd94f8b46dc/html5/thumbnails/11.jpg)
Mobile Team Organization
Agile
From Concept To Store
![Page 12: Green Light for the Apps with Calaba.sh - DroidCon Paris 2014](https://reader033.vdocuments.us/reader033/viewer/2022060121/559452b01a28abd94f8b46dc/html5/thumbnails/12.jpg)
Mobile Team Organization
Agile
From Concept To Store
![Page 13: Green Light for the Apps with Calaba.sh - DroidCon Paris 2014](https://reader033.vdocuments.us/reader033/viewer/2022060121/559452b01a28abd94f8b46dc/html5/thumbnails/13.jpg)
Mobile Team Organization
Agile
From Concept To Store
![Page 14: Green Light for the Apps with Calaba.sh - DroidCon Paris 2014](https://reader033.vdocuments.us/reader033/viewer/2022060121/559452b01a28abd94f8b46dc/html5/thumbnails/14.jpg)
Mobile Team Organization
Agile
From Concept To Store
![Page 15: Green Light for the Apps with Calaba.sh - DroidCon Paris 2014](https://reader033.vdocuments.us/reader033/viewer/2022060121/559452b01a28abd94f8b46dc/html5/thumbnails/15.jpg)
Green light to submit Apps Quality Status
![Page 16: Green Light for the Apps with Calaba.sh - DroidCon Paris 2014](https://reader033.vdocuments.us/reader033/viewer/2022060121/559452b01a28abd94f8b46dc/html5/thumbnails/16.jpg)
Code Quality
• Readable
• Unit Tested
• Smart Architecture
• Maintenable
![Page 17: Green Light for the Apps with Calaba.sh - DroidCon Paris 2014](https://reader033.vdocuments.us/reader033/viewer/2022060121/559452b01a28abd94f8b46dc/html5/thumbnails/17.jpg)
• The code do what we want
• Work with external
components
Functional Quality
![Page 18: Green Light for the Apps with Calaba.sh - DroidCon Paris 2014](https://reader033.vdocuments.us/reader033/viewer/2022060121/559452b01a28abd94f8b46dc/html5/thumbnails/18.jpg)
Different Type of Test
• Unit Test
• Integration Test
• Functional Test
![Page 19: Green Light for the Apps with Calaba.sh - DroidCon Paris 2014](https://reader033.vdocuments.us/reader033/viewer/2022060121/559452b01a28abd94f8b46dc/html5/thumbnails/19.jpg)
Different Type of Test
• Unit Test
• Integration Test
• Functional Test
![Page 20: Green Light for the Apps with Calaba.sh - DroidCon Paris 2014](https://reader033.vdocuments.us/reader033/viewer/2022060121/559452b01a28abd94f8b46dc/html5/thumbnails/20.jpg)
Functional Test Tools
![Page 21: Green Light for the Apps with Calaba.sh - DroidCon Paris 2014](https://reader033.vdocuments.us/reader033/viewer/2022060121/559452b01a28abd94f8b46dc/html5/thumbnails/21.jpg)
Why Calaba.sh? The Functional Tool Choice
![Page 22: Green Light for the Apps with Calaba.sh - DroidCon Paris 2014](https://reader033.vdocuments.us/reader033/viewer/2022060121/559452b01a28abd94f8b46dc/html5/thumbnails/22.jpg)
Specification written with Gherkin
All the test cases in Meetic look like:
• Given <the context>
• When <users do actions>
• Then <expected result>
![Page 23: Green Light for the Apps with Calaba.sh - DroidCon Paris 2014](https://reader033.vdocuments.us/reader033/viewer/2022060121/559452b01a28abd94f8b46dc/html5/thumbnails/23.jpg)
Multi-platform Support
Android iOS
![Page 24: Green Light for the Apps with Calaba.sh - DroidCon Paris 2014](https://reader033.vdocuments.us/reader033/viewer/2022060121/559452b01a28abd94f8b46dc/html5/thumbnails/24.jpg)
Mature
• Open Sourced since February 2012
• Based on Cucumber • Born in 2008
• Over 200 contributors
• Backed and developed by Xamarin
![Page 25: Green Light for the Apps with Calaba.sh - DroidCon Paris 2014](https://reader033.vdocuments.us/reader033/viewer/2022060121/559452b01a28abd94f8b46dc/html5/thumbnails/25.jpg)
Hands On Code inside
![Page 26: Green Light for the Apps with Calaba.sh - DroidCon Paris 2014](https://reader033.vdocuments.us/reader033/viewer/2022060121/559452b01a28abd94f8b46dc/html5/thumbnails/26.jpg)
The Feature Scenario
@login!
Feature: Login feature!
As a Meetic user!
In order to enjoy the service!
I want to be able to log into the service!
!
Scenario: Wrong Login!
Given I am on the Login screen!
When I enter my credentials [email protected] and foobar!
And I press confirm!
Then I should see an error message!
![Page 27: Green Light for the Apps with Calaba.sh - DroidCon Paris 2014](https://reader033.vdocuments.us/reader033/viewer/2022060121/559452b01a28abd94f8b46dc/html5/thumbnails/27.jpg)
The Feature Scenario
@login!
Feature: Login feature!
As a Meetic user!
In order to enjoy the service!
I want to be able to log into the service!
!
Scenario: Wrong Login!
Given I am on the Login screen!
When I enter my credentials [email protected] and foobar!
And I press confirm!
Then I should see an error message!
![Page 28: Green Light for the Apps with Calaba.sh - DroidCon Paris 2014](https://reader033.vdocuments.us/reader033/viewer/2022060121/559452b01a28abd94f8b46dc/html5/thumbnails/28.jpg)
The Feature Scenario
@login!
Feature: Login feature!
As a Meetic user!
In order to enjoy the service!
I want to be able to log into the service!
!
Scenario: Wrong Login!
Given I am on the Login screen!
When I enter my credentials [email protected] and foobar!
And I press confirm!
Then I should see an error message!
![Page 29: Green Light for the Apps with Calaba.sh - DroidCon Paris 2014](https://reader033.vdocuments.us/reader033/viewer/2022060121/559452b01a28abd94f8b46dc/html5/thumbnails/29.jpg)
The Feature Scenario
@login!
Feature: Login feature!
As a Meetic user!
In order to enjoy the service!
I want to be able to log into the service!
!
Scenario: Wrong Login!
Given I am on the Login screen!
When I enter my credentials [email protected] and foobar!
And I press confirm!
Then I should see an error message!
![Page 30: Green Light for the Apps with Calaba.sh - DroidCon Paris 2014](https://reader033.vdocuments.us/reader033/viewer/2022060121/559452b01a28abd94f8b46dc/html5/thumbnails/30.jpg)
The Android Source Code – non intrusive
![Page 31: Green Light for the Apps with Calaba.sh - DroidCon Paris 2014](https://reader033.vdocuments.us/reader033/viewer/2022060121/559452b01a28abd94f8b46dc/html5/thumbnails/31.jpg)
An example step definition – the glue
When(/^I enter my credentials (\S*) and (\S*)$/) do |login, password|!
wait_for_screen :login!
!
step 'I enter text "" into field with id "loginEdit"'!
step "I enter text \"#{login}\" into field with id \"loginEdit\""!
step 'I enter text "" into field with id "passwordEdit"'!
step "I enter text \"#{password}\" into field with id \"passwordEdit\""!
end!!
!
!
![Page 32: Green Light for the Apps with Calaba.sh - DroidCon Paris 2014](https://reader033.vdocuments.us/reader033/viewer/2022060121/559452b01a28abd94f8b46dc/html5/thumbnails/32.jpg)
Run!
![Page 33: Green Light for the Apps with Calaba.sh - DroidCon Paris 2014](https://reader033.vdocuments.us/reader033/viewer/2022060121/559452b01a28abd94f8b46dc/html5/thumbnails/33.jpg)
The result – human readable
![Page 34: Green Light for the Apps with Calaba.sh - DroidCon Paris 2014](https://reader033.vdocuments.us/reader033/viewer/2022060121/559452b01a28abd94f8b46dc/html5/thumbnails/34.jpg)
How does it works?
Running environment
Features
Step definitions, Ruby client library
Devices/Emulators
Your app
Instrumentation Test server
Source: http://blog.lesspainful.com/2012/03/07/Calabash-Android/
![Page 35: Green Light for the Apps with Calaba.sh - DroidCon Paris 2014](https://reader033.vdocuments.us/reader033/viewer/2022060121/559452b01a28abd94f8b46dc/html5/thumbnails/35.jpg)
The commands
Installation $>sudo gem install calabash-android!
Setup $your_android_project_dir>calabash-android gen!
Run tests $>calabash-android resign <your apk>!$>calabash-android run <your apk>!$>ADB_DEVICE_ARG=<your device> calabash-android run <your apk>!!
Better format output $>calabash-android run <your apk> --format html --out result.html!
!
!
![Page 36: Green Light for the Apps with Calaba.sh - DroidCon Paris 2014](https://reader033.vdocuments.us/reader033/viewer/2022060121/559452b01a28abd94f8b46dc/html5/thumbnails/36.jpg)
Industrialization
![Page 37: Green Light for the Apps with Calaba.sh - DroidCon Paris 2014](https://reader033.vdocuments.us/reader033/viewer/2022060121/559452b01a28abd94f8b46dc/html5/thumbnails/37.jpg)
• Map of our code
• Ease the issue localisation
Automated Tests
![Page 38: Green Light for the Apps with Calaba.sh - DroidCon Paris 2014](https://reader033.vdocuments.us/reader033/viewer/2022060121/559452b01a28abd94f8b46dc/html5/thumbnails/38.jpg)
Continuous Integration
>
![Page 39: Green Light for the Apps with Calaba.sh - DroidCon Paris 2014](https://reader033.vdocuments.us/reader033/viewer/2022060121/559452b01a28abd94f8b46dc/html5/thumbnails/39.jpg)
Experience Sharing
![Page 40: Green Light for the Apps with Calaba.sh - DroidCon Paris 2014](https://reader033.vdocuments.us/reader033/viewer/2022060121/559452b01a28abd94f8b46dc/html5/thumbnails/40.jpg)
Multi Language
• 12 languages management
• 4 brands
Calabash Ruby API
backdoor(method,arg)
1
![Page 41: Green Light for the Apps with Calaba.sh - DroidCon Paris 2014](https://reader033.vdocuments.us/reader033/viewer/2022060121/559452b01a28abd94f8b46dc/html5/thumbnails/41.jpg)
Backdoor with calabash
• Need to run only when we are using calabash
• The backdoor can call method only in the current activity tested
Create a specific target for Calabash
1
![Page 42: Green Light for the Apps with Calaba.sh - DroidCon Paris 2014](https://reader033.vdocuments.us/reader033/viewer/2022060121/559452b01a28abd94f8b46dc/html5/thumbnails/42.jpg)
In your Android app
public class MainActivitiy extends Activity { ! public String calabashGetStringById(String stringId) { ! String stringToReturn = “”; ! if (id != null && !id.isEmpty()) { ! Resources resources = getResources(); !
int resourceId = resources.getIdentifier(stringId, “string”, getPackageName()); ! stringToReturn = resources.getString(resourceId); !
} !
return stringToReturn; !
} !
} !
1
![Page 43: Green Light for the Apps with Calaba.sh - DroidCon Paris 2014](https://reader033.vdocuments.us/reader033/viewer/2022060121/559452b01a28abd94f8b46dc/html5/thumbnails/43.jpg)
In your glue
Given(/^I see the title “([^\”]*)”$/) do |key_string| ! title = backdoor(“calabashGetStringById”, key_string) ! wait_for_text(title) !end !
1
![Page 44: Green Light for the Apps with Calaba.sh - DroidCon Paris 2014](https://reader033.vdocuments.us/reader033/viewer/2022060121/559452b01a28abd94f8b46dc/html5/thumbnails/44.jpg)
Execution Time
• Take time to execute the test
• During Dev, need to be productive
Use label
$>calabash-android run <your apk> --tags <your tags>!
Example
$>calabash-android run myapp.apk --tags @login!
2
![Page 45: Green Light for the Apps with Calaba.sh - DroidCon Paris 2014](https://reader033.vdocuments.us/reader033/viewer/2022060121/559452b01a28abd94f8b46dc/html5/thumbnails/45.jpg)
Dedicated Environment
• Control the Data Set
• Setup the Back End
Huge amount of work!
Mock usage 3
![Page 46: Green Light for the Apps with Calaba.sh - DroidCon Paris 2014](https://reader033.vdocuments.us/reader033/viewer/2022060121/559452b01a28abd94f8b46dc/html5/thumbnails/46.jpg)
Behavior Driven Development
• Write the expected Behavior in human language before implementation
• User centric
• Use concrete examples
• No context
Work closely with Product and Dev
Define a company dictionary for the test 4
![Page 47: Green Light for the Apps with Calaba.sh - DroidCon Paris 2014](https://reader033.vdocuments.us/reader033/viewer/2022060121/559452b01a28abd94f8b46dc/html5/thumbnails/47.jpg)
Functional Test Cover
• Functional tests need to stay maintenable
• Don’t cover all the cases with automatic tests!
Automatic tests of the main cases • Main path of the customers
• Nominal cases
Manual Testing needed for specific cases
5
![Page 48: Green Light for the Apps with Calaba.sh - DroidCon Paris 2014](https://reader033.vdocuments.us/reader033/viewer/2022060121/559452b01a28abd94f8b46dc/html5/thumbnails/48.jpg)
Conclusion
We are hiring!
http://jobs.meetic.fr/
![Page 49: Green Light for the Apps with Calaba.sh - DroidCon Paris 2014](https://reader033.vdocuments.us/reader033/viewer/2022060121/559452b01a28abd94f8b46dc/html5/thumbnails/49.jpg)
Any Question ?
Thanks!