Cucumber

Frédérick Ros

Introduction

Frédérick Ros

56%

Communication Breakdown



Maximize
the
communication

How ?

Software behaviour

must be described

in a user readable manner

Cucumber

Describe feature
in
natural language

But …


Features

Feature example

Feature: Division
  In order to avoid silly mistakes
  Cashiers must be able to calculate a fraction

  Scenario: Regular numbers
    Given I have entered 3 into the calculator
    And I have entered 2 into the calculator
    When I press divide
    Then the result should be 1.5 on the screen
  

Given / When / Then en

Soit / Lorsque / Alors fr

Angenommen / Wenn / Dann de

前提 / もし / ならば ja

...

I CAN HAZ / WEN / DEN en-lol

Scenario outlines

  Scenario: Regular numbers
    Given I have entered <a number> into the calculator
    And I have entered <another number> into the calculator
    When I press divide
    Then the result should be <result> on the screen

  Examples:
    | a number | another number | result |
    |   12     |        5       |   7    |
    |   20     |        5       |   15   |
  

Background

  Background:
    Given a global administrator named "Greg"
    And a blog named "Greg's anti-tax rants"
    And a customer named "Dr. Bill"
    And a blog named "Expensive Therapy" owned by "Dr. Bill"

  Scenario: Dr. Bill posts to his own blog
    Given I am logged in as Dr. Bill
    When I try to post to "Expensive Therapy"
    Then I should see "Your article was published."
  

Steps

Step definition

Given I have entered 3 feature
Given /I have entered (\d+)/ do |number|
    ## Some ruby code 
end step
    

Cucumber will spot:

Screen output

But other output formats exist ...

Example of Test Subjects



(short) Demo time

Use Cases

Outside/In Dev

UAT

Production Monitoring

Features

+

Screenshots

+

Custom formatter

=

User documentation !

Feature Life Cycle

Conclusion

Cucumber


Cucumber, c'est bon, mangez-en !