Functional tests with

Calabash

Calabash

Automated acceptance testing for mobile apps

For iOS and Android native apps

Open source, made by Xamarin

Assertions are powered by Cucumber and written in steps, usually using plain English sentences

Written in Ruby

Assertions

@chooz-login
Feature:
  Scenario:
    Given I wait for "Chooz ze good" to appear

    Then I press "Se connecter avec email"
    Then I wait for "Ton mot de passe" to appear
    Then I press "Revenir"
    And I wait for "Chooz ze good" to appear
    Then I press "Se connecter avec email"
    Then I wait for "Ton mot de passe" to appear
Then(/^I should see '(.*)'$/) do |expected_mark|
  until element_exists("view marked:'#{expected_mark}'") 
    || element_exists("view text:'#{expected_mark}'")
    screenshot_and_raise "No element found: #{expected_mark}"
  end
end

Features with scenarios

Steps

How does it works?

Setting up Calabash with React Native

Installing Calabash-ios

https://github.com/calabash/calabash-ios

Tutorial & documentation on the GitHub:

I added Calabash to a React Native app:

https://github.com/bamlab/rn-calabash-demo

DEMO TIME

Predefined steps

I wait for "..." to appear
I touch "..."
I should see "..."
I should see text starting with "prefix"
I enter "..." into input field number 1
I pinch to zoom in
I swipe left
I take picture

https://github.com/calabash/calabash-ios/wiki/02-Predefined-steps

See documentation:

Write new steps:

https://github.com/calabash/calabash-ios/wiki/Calabash-iOS-Ruby-API

Pain points

Something fails for obscure reasons

Relaunch the iOS simulator for each feature to test

Hard to launch on a CI server

Functional tests are taking ages to run

Steps are different for Android & iOS 

Thanks!

Introduction to functional tests with Calabash

By Florian Rival

Introduction to functional tests with Calabash

Quick introduction to functional tests with Calabash

  • 2,754