5. 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
22. Specification written with Gherkin
All the test cases in Meetic
look like:
• Given <the context>
• When <users do actions>
• Then <expected result>
26. 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 calabash_error@calabash.com and foobar!
And I press confirm!
Then I should see an error message!
27. 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 calabash_error@calabash.com and foobar!
And I press confirm!
Then I should see an error message!
28. 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 calabash_error@calabash.com and foobar!
And I press confirm!
Then I should see an error message!
29. 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 calabash_error@calabash.com and foobar!
And I press confirm!
Then I should see an error message!
31. 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!
!
!
!
34. How does it works?
Step definitions,
Ruby client library
Features
Running environment
Instrumentation
Test server
Your app
Devices/Emulators
Source: http://blog.lesspainful.com/2012/03/07/Calabash-Android/
35. 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!
!
!
40. Multi Language
• 12 languages management
• 4 brands
Calabash Ruby API
backdoor(method,arg)
1
41. 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
42. 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
43. In your glue
Given(/^I see the title “([^”]*)”$/) do |key_string|!
title = backdoor(“calabashGetStringById”, key_string)!
wait_for_text(title)!
end!
1
44. 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
45. Dedicated Environment
• Control the Data Set
• Setup the Back End
Huge amount of work!
Mock usage
3
46. 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
47. 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