SlideShare a Scribd company logo
1 of 25
Download to read offline
Title
geek time - Novembre 2016
HALLEB Khaled
OLBATI Consultant
OLBATI © 2016 - Geek Time November 2016 2
Cucumber?
● Tool for running automated tests
■ Support BDD ( using Gherkin language)
■ A single source of truth
■ Living documentation
■ Focus on the customer
■ Less rework
OLBATI © 2016 - Geek Time November 2016 3
Cucumber and BDD ?
● Cucumber is for Behaviour-Driven Development
OLBATI © 2016 - Geek Time November 2016 4
Gherkin
● Gherkin is plain-text English (or one of 60+ other languages) with a little extra
structure
● Feature (Functionality) written in .feature files and defined by
● Feature − Name of the feature under test.
● Description (optional) − Describe about feature under test.
● Scenario − What is the test scenario.
● Steps
OLBATI © 2016 - Geek Time November 2016 5
Gherkin
● Description
Feature: <feature title>
As a <persona|role>
I want to <action>
So that <outcome>
OLBATI © 2016 - Geek Time November 2016 6
Gherkin
● Scenario
A scenario is a concrete example that illustrates a business rule.
It is a list of steps.
You can have as many steps as you like, but we recommend you keep the
number at 3-5 per scenario. If they become longer than that they lose their
expressive power as specification and documentation.
OLBATI © 2016 - Geek Time November 2016 7
Gherkin
● Step
● Given − Prerequisite before the test steps get executed.
● When − Specific condition which should match in order to
execute the next step.
● Then − What should happen if the condition mentioned in
WHEN is satisfied.
If there are multiple Given or When steps underneath each other, you can use And
or But
OLBATI © 2016 - Geek Time November 2016 8
Gherkin
● Backgound
Occasionally you'll find yourself repeating the same Given steps in all of the
scenarios in a feature file. Since it is repeated in every scenario it is an
indication that those steps are not essential to describe the scenarios, they
are incidental details.
You can literally move such Given steps to the background by grouping them
under a Background section before the first scenario:
Background:
Given a $100 microwave was sold on 2015-11-03
And today is 2015-11-18
OLBATI © 2016 - Geek Time November 2016 9
Gherkin
● Scenario Outline
When you have a complex business rule with severable variable inputs or outputs you might end up
creating several scenarios that only differ by their values.
1- Scenario: feeding a small suckler cow
Given the cow weighs 450 kg
When we calculate the feeding requirements
Then the energy should be 26500 MJ
And the protein should be 215 kg
2- Scenario: feeding a medium suckler cow
Given the cow weighs 500 kg
When we calculate the feeding requirements
Then the energy should be 29500 MJ
And the protein should be 245 kg
#
OLBATI © 2016 - Geek Time November 2016 10
Gherkin
Scenario Outline: feeding a suckler cow
Given the cow weighs <weight> kg
When we calculate the feeding requirements
Then the energy should be <energy> MJ
And the protein should be <protein> kg
Examples:
| weight | energy | protein |
| 450 | 26500 | 215 |
| 500 | 29500 | 245 |
| 575 | 31500 | 255 |
| 600 | 37000 | 305 |
OLBATI © 2016 - Geek Time November 2016 11
Gherkin
● Example
A Scenario Outline section is always followed by one or more Examples sections,
which are a container for a table.
The table must have a header row corresponding to the variables in the Scenario
Outline steps.
Each of the rows below will create a new Scenario, filling in the variable values.
OLBATI © 2016 - Geek Time November 2016 12
Gherkin
● Step Arguments
In some cases you might want to pass a larger chunk of text or a table of data
to a step---something that doesn't fit on a single line.
For this purpose Gherkin has Doc Strings and Data Tables.
Given a blog post named "Random" with Markdown body
"""
Some Title, Eh?
===============
Here is the first paragraph of my blog post. Lorem ipsum dolor sit amet,
consectetur adipiscing elit.
"""
OLBATI © 2016 - Geek Time November 2016 13
Gherkin
Given the following users exist:
| name | email | twitter |
| Aslak | aslak@cucumber.io | @aslak_hellesoy |
| Julien | julien@cucumber.io | @jbpros |
| Matt | matt@cucumber.io | @mattwynne |
OLBATI © 2016 - Geek Time November 2016 14
Gherkin
● Tags
Tags are a way to group Scenarios. They are @-prefixed strings and you can
place as many tags as you like above Feature, Scenario, Scenario Outline or
Examples keywords. Space character are invalid in tags and may separate
them.
Tags are inherited from parent elements. For example, if you place a tag
above a Feature, all scenarios in that feature will get that tag.
OLBATI © 2016 - Geek Time November 2016 15
Gherkin
@tag1 @tag2 @tag3
Feature: name
@RunWith(Cucumber.class)
@Cucumber.Options(format = {"pretty", "html:target/cucumber"}, tags =
{"~@tag1"})
public class runTest { }
OLBATI © 2016 - Geek Time November 2016 16
Gherkin
● Comment
we just need to put # before beginning your comment.
OLBATI © 2016 - Geek Time November 2016 17
Step Definitions
Cucumber doesn't know how to execute your scenarios out-of-the-box. It needs
Step Definitions to translate plain text Gherkin steps into actions that will interact
with the system.
OLBATI © 2016 - Geek Time November 2016 18
Step Definitions
public class OnesNumbersSteps {
@Given("....(d+)$")
public void the_menu_contains_the_following_dishes(final Integer quantity) {}
@When("...")
public void the_customer_order() {}
@Then("^...$")
public void the_result_should_be_I(){}
}
OLBATI © 2016 - Geek Time November 2016 19
Cucumber implementations
■ Ruby/JRuby
■ JRuby (using Cucumber-JVM)
■ Java
■ Groovy
■ JavaScript
■ JavaScript (using Cucumber-JVM and Rhino)
■ Clojure
■ Gosu
■ Lua
■ .NET (using SpecFlow)
■ PHP (using Behat)
■ Jython
■ C++
■ Tcl
OLBATI © 2016 - Geek Time November 2016 20
Cucumber-JVM
● Maven dependency
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-java</artifactId>
<version>1.2.4-SNAPSHOT</version>
<scope>test</scope>
</dependency>
OLBATI © 2016 - Geek Time November 2016 21
Running Cucumber
● JUnit Runner
import cucumber.api.junit.Cucumber;
import org.junit.runner.RunWith;
@RunWith(Cucumber.class)
public class RunCukesTest {
}
OLBATI © 2016 - Geek Time November 2016 22
Running Cucumber
● CLI Runner
mvn test -Dcucumber.options="--help"
will print out:
Usage: java cucumber.api.cli.Main [options] [[[FILE|DIR][:LINE[:LINE]*] ]+ | @FILE ]
OLBATI © 2016 - Geek Time November 2016 23
Running Cucumber
● Third party runners
IntelliJ IDEA and Eclipse have plugins that can run scenarios from within an IDE:
■ IntelliJ IDEA
■ Cucumber-Eclipse
OLBATI © 2016 - Geek Time November 2016 24
Kata : Arabic To Roman Numerals
1 = I
2 = II
3 = III
4 = IV
5 = V
6 = VI
7 = VII
8 = VIII
9 = IX
10 = X
20 = XX
30 = XXX
40 = XL
50 = L
60 = LX
70 = LXX
80 = LXXX
90 = XC
100 = C
500 = D
1000 = M
2000 = MM
OLBATI © 2016 - Geek Time November 2016 25
Thanks!
Any questions?
halleb.khaled@gmail.com

More Related Content

What's hot

働きやすい社内を目指す!二酸化炭素計測ツール
働きやすい社内を目指す!二酸化炭素計測ツール働きやすい社内を目指す!二酸化炭素計測ツール
働きやすい社内を目指す!二酸化炭素計測ツール鉄次 尾形
 
ATLRUG Community Announcements for December 2016
ATLRUG Community Announcements for December 2016ATLRUG Community Announcements for December 2016
ATLRUG Community Announcements for December 2016jasnow
 
AngularJs - From Heedless Meddler to Superheroic Assistant
AngularJs - From Heedless Meddler to Superheroic AssistantAngularJs - From Heedless Meddler to Superheroic Assistant
AngularJs - From Heedless Meddler to Superheroic AssistantMiloš Bošković
 
ATLRUG Announcements - October 2016
ATLRUG Announcements - October 2016ATLRUG Announcements - October 2016
ATLRUG Announcements - October 2016jasnow
 
Linq (from the inside)
Linq (from the inside)Linq (from the inside)
Linq (from the inside)Mike Clement
 
Sinatraで触れる生SQL
Sinatraで触れる生SQLSinatraで触れる生SQL
Sinatraで触れる生SQLtreby
 
How to Build APIs - MHacks 2016
How to Build APIs - MHacks 2016How to Build APIs - MHacks 2016
How to Build APIs - MHacks 2016Dan Cundiff
 
Smoothing the Continuous Delivery Path - A Tale of Two Teams
Smoothing the Continuous Delivery Path - A Tale of Two TeamsSmoothing the Continuous Delivery Path - A Tale of Two Teams
Smoothing the Continuous Delivery Path - A Tale of Two TeamsEqual Experts
 
Who I am and What I have done ever since/自己紹介スライド
Who I am and What I have done ever since/自己紹介スライドWho I am and What I have done ever since/自己紹介スライド
Who I am and What I have done ever since/自己紹介スライドtakayukimaeda3
 
Automating Image build to ensure compliance, metrics, and auditing, in Multi-...
Automating Image build to ensure compliance, metrics, and auditing, in Multi-...Automating Image build to ensure compliance, metrics, and auditing, in Multi-...
Automating Image build to ensure compliance, metrics, and auditing, in Multi-...Evaldo Felipe
 
Graphlab Create 簡介
Graphlab Create 簡介Graphlab Create 簡介
Graphlab Create 簡介Simon Li
 
Introduction for Master Class "Amazing Reactive Forms"
Introduction for Master Class "Amazing Reactive Forms"Introduction for Master Class "Amazing Reactive Forms"
Introduction for Master Class "Amazing Reactive Forms"Fabio Biondi
 
Git in pills : git stash
Git in pills : git stashGit in pills : git stash
Git in pills : git stashFederico Panini
 

What's hot (18)

Serving ML easily with FastAPI - meme version
Serving ML easily with FastAPI - meme versionServing ML easily with FastAPI - meme version
Serving ML easily with FastAPI - meme version
 
働きやすい社内を目指す!二酸化炭素計測ツール
働きやすい社内を目指す!二酸化炭素計測ツール働きやすい社内を目指す!二酸化炭素計測ツール
働きやすい社内を目指す!二酸化炭素計測ツール
 
ATLRUG Community Announcements for December 2016
ATLRUG Community Announcements for December 2016ATLRUG Community Announcements for December 2016
ATLRUG Community Announcements for December 2016
 
AngularJs - From Heedless Meddler to Superheroic Assistant
AngularJs - From Heedless Meddler to Superheroic AssistantAngularJs - From Heedless Meddler to Superheroic Assistant
AngularJs - From Heedless Meddler to Superheroic Assistant
 
Introduction to AngularJS
Introduction to AngularJSIntroduction to AngularJS
Introduction to AngularJS
 
PHP Application Performance
PHP Application PerformancePHP Application Performance
PHP Application Performance
 
ATLRUG Announcements - October 2016
ATLRUG Announcements - October 2016ATLRUG Announcements - October 2016
ATLRUG Announcements - October 2016
 
Linq (from the inside)
Linq (from the inside)Linq (from the inside)
Linq (from the inside)
 
Intro to ES6 / ES2015
Intro to ES6 / ES2015Intro to ES6 / ES2015
Intro to ES6 / ES2015
 
Sinatraで触れる生SQL
Sinatraで触れる生SQLSinatraで触れる生SQL
Sinatraで触れる生SQL
 
How to Build APIs - MHacks 2016
How to Build APIs - MHacks 2016How to Build APIs - MHacks 2016
How to Build APIs - MHacks 2016
 
Git essentials
Git essentialsGit essentials
Git essentials
 
Smoothing the Continuous Delivery Path - A Tale of Two Teams
Smoothing the Continuous Delivery Path - A Tale of Two TeamsSmoothing the Continuous Delivery Path - A Tale of Two Teams
Smoothing the Continuous Delivery Path - A Tale of Two Teams
 
Who I am and What I have done ever since/自己紹介スライド
Who I am and What I have done ever since/自己紹介スライドWho I am and What I have done ever since/自己紹介スライド
Who I am and What I have done ever since/自己紹介スライド
 
Automating Image build to ensure compliance, metrics, and auditing, in Multi-...
Automating Image build to ensure compliance, metrics, and auditing, in Multi-...Automating Image build to ensure compliance, metrics, and auditing, in Multi-...
Automating Image build to ensure compliance, metrics, and auditing, in Multi-...
 
Graphlab Create 簡介
Graphlab Create 簡介Graphlab Create 簡介
Graphlab Create 簡介
 
Introduction for Master Class "Amazing Reactive Forms"
Introduction for Master Class "Amazing Reactive Forms"Introduction for Master Class "Amazing Reactive Forms"
Introduction for Master Class "Amazing Reactive Forms"
 
Git in pills : git stash
Git in pills : git stashGit in pills : git stash
Git in pills : git stash
 

Viewers also liked

Geek Time December 2016 : Swagger II
Geek Time December 2016 : Swagger IIGeek Time December 2016 : Swagger II
Geek Time December 2016 : Swagger IIOLBATI
 
Geek Time Août 2016 : Docker
Geek Time Août 2016 : DockerGeek Time Août 2016 : Docker
Geek Time Août 2016 : DockerOLBATI
 
Geek Time December 2016 : Quiz Java 8
Geek Time December 2016 : Quiz Java 8Geek Time December 2016 : Quiz Java 8
Geek Time December 2016 : Quiz Java 8OLBATI
 
Geek Time Janvier 2017 : Angular 2
Geek Time Janvier 2017 : Angular 2Geek Time Janvier 2017 : Angular 2
Geek Time Janvier 2017 : Angular 2OLBATI
 
Geek Time Janvier 2017 : Java 8
Geek Time Janvier 2017 : Java 8Geek Time Janvier 2017 : Java 8
Geek Time Janvier 2017 : Java 8OLBATI
 
Geek Time December 2016 : Bitcoin/Blockchain
Geek Time December 2016 : Bitcoin/BlockchainGeek Time December 2016 : Bitcoin/Blockchain
Geek Time December 2016 : Bitcoin/BlockchainOLBATI
 

Viewers also liked (6)

Geek Time December 2016 : Swagger II
Geek Time December 2016 : Swagger IIGeek Time December 2016 : Swagger II
Geek Time December 2016 : Swagger II
 
Geek Time Août 2016 : Docker
Geek Time Août 2016 : DockerGeek Time Août 2016 : Docker
Geek Time Août 2016 : Docker
 
Geek Time December 2016 : Quiz Java 8
Geek Time December 2016 : Quiz Java 8Geek Time December 2016 : Quiz Java 8
Geek Time December 2016 : Quiz Java 8
 
Geek Time Janvier 2017 : Angular 2
Geek Time Janvier 2017 : Angular 2Geek Time Janvier 2017 : Angular 2
Geek Time Janvier 2017 : Angular 2
 
Geek Time Janvier 2017 : Java 8
Geek Time Janvier 2017 : Java 8Geek Time Janvier 2017 : Java 8
Geek Time Janvier 2017 : Java 8
 
Geek Time December 2016 : Bitcoin/Blockchain
Geek Time December 2016 : Bitcoin/BlockchainGeek Time December 2016 : Bitcoin/Blockchain
Geek Time December 2016 : Bitcoin/Blockchain
 

Similar to Geek Time Novembre 2016 : Cucumber

SpringOne Platform recap 정윤진
SpringOne Platform recap 정윤진SpringOne Platform recap 정윤진
SpringOne Platform recap 정윤진VMware Tanzu Korea
 
"Xapi-lang For declarative code generation" By James Nelson
"Xapi-lang For declarative code generation" By James Nelson"Xapi-lang For declarative code generation" By James Nelson
"Xapi-lang For declarative code generation" By James NelsonGWTcon
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Getting started with Apache Camel - jDays 2013
Getting started with Apache Camel - jDays 2013Getting started with Apache Camel - jDays 2013
Getting started with Apache Camel - jDays 2013Claus Ibsen
 
Apache Spark Super Happy Funtimes - CHUG 2016
Apache Spark Super Happy Funtimes - CHUG 2016Apache Spark Super Happy Funtimes - CHUG 2016
Apache Spark Super Happy Funtimes - CHUG 2016Holden Karau
 
Efficient Django
Efficient DjangoEfficient Django
Efficient DjangoDavid Arcos
 
Introduction to Django
Introduction to DjangoIntroduction to Django
Introduction to DjangoJames Casey
 
Gobblin @ NerdWallet (Nov 2015)
Gobblin @ NerdWallet (Nov 2015)Gobblin @ NerdWallet (Nov 2015)
Gobblin @ NerdWallet (Nov 2015)NerdWalletHQ
 
Global Innovation Nights - Spark
Global Innovation Nights - SparkGlobal Innovation Nights - Spark
Global Innovation Nights - SparkWorks Applications
 
SEO for Large/Enterprise Websites - Data & Tech Side
SEO for Large/Enterprise Websites - Data & Tech SideSEO for Large/Enterprise Websites - Data & Tech Side
SEO for Large/Enterprise Websites - Data & Tech SideDominic Woodman
 
VSSML16 L8. Advanced Workflows: Feature Selection, Boosting, Gradient Descent...
VSSML16 L8. Advanced Workflows: Feature Selection, Boosting, Gradient Descent...VSSML16 L8. Advanced Workflows: Feature Selection, Boosting, Gradient Descent...
VSSML16 L8. Advanced Workflows: Feature Selection, Boosting, Gradient Descent...BigML, Inc
 
Logical replication with pglogical
Logical replication with pglogicalLogical replication with pglogical
Logical replication with pglogicalUmair Shahid
 
DA 592 - Term Project Report - Berker Kozan Can Koklu
DA 592 - Term Project Report - Berker Kozan Can KokluDA 592 - Term Project Report - Berker Kozan Can Koklu
DA 592 - Term Project Report - Berker Kozan Can KokluCan Köklü
 
Validating Big Data Pipelines - Big Data Spain 2018
Validating Big Data Pipelines - Big Data Spain 2018Validating Big Data Pipelines - Big Data Spain 2018
Validating Big Data Pipelines - Big Data Spain 2018Holden Karau
 
Hadoop: Big Data Stacks validation w/ iTest How to tame the elephant?
Hadoop:  Big Data Stacks validation w/ iTest  How to tame the elephant?Hadoop:  Big Data Stacks validation w/ iTest  How to tame the elephant?
Hadoop: Big Data Stacks validation w/ iTest How to tame the elephant?Dmitri Shiryaev
 
Contributing to Apache Spark 3
Contributing to Apache Spark 3Contributing to Apache Spark 3
Contributing to Apache Spark 3Holden Karau
 
Take A Gulp at Task Automation
Take A Gulp at Task AutomationTake A Gulp at Task Automation
Take A Gulp at Task AutomationJoel Lord
 
Kubernetes - State of the Union (Q1-2016)
Kubernetes - State of the Union (Q1-2016)Kubernetes - State of the Union (Q1-2016)
Kubernetes - State of the Union (Q1-2016)DoiT International
 

Similar to Geek Time Novembre 2016 : Cucumber (20)

SpringOne Platform recap 정윤진
SpringOne Platform recap 정윤진SpringOne Platform recap 정윤진
SpringOne Platform recap 정윤진
 
"Xapi-lang For declarative code generation" By James Nelson
"Xapi-lang For declarative code generation" By James Nelson"Xapi-lang For declarative code generation" By James Nelson
"Xapi-lang For declarative code generation" By James Nelson
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Getting started with Apache Camel - jDays 2013
Getting started with Apache Camel - jDays 2013Getting started with Apache Camel - jDays 2013
Getting started with Apache Camel - jDays 2013
 
groovy & grails - lecture 6
groovy & grails - lecture 6groovy & grails - lecture 6
groovy & grails - lecture 6
 
Apache Spark Super Happy Funtimes - CHUG 2016
Apache Spark Super Happy Funtimes - CHUG 2016Apache Spark Super Happy Funtimes - CHUG 2016
Apache Spark Super Happy Funtimes - CHUG 2016
 
Efficient Django
Efficient DjangoEfficient Django
Efficient Django
 
Introduction to Django
Introduction to DjangoIntroduction to Django
Introduction to Django
 
Gobblin @ NerdWallet (Nov 2015)
Gobblin @ NerdWallet (Nov 2015)Gobblin @ NerdWallet (Nov 2015)
Gobblin @ NerdWallet (Nov 2015)
 
ArangoDB
ArangoDBArangoDB
ArangoDB
 
Global Innovation Nights - Spark
Global Innovation Nights - SparkGlobal Innovation Nights - Spark
Global Innovation Nights - Spark
 
SEO for Large/Enterprise Websites - Data & Tech Side
SEO for Large/Enterprise Websites - Data & Tech SideSEO for Large/Enterprise Websites - Data & Tech Side
SEO for Large/Enterprise Websites - Data & Tech Side
 
VSSML16 L8. Advanced Workflows: Feature Selection, Boosting, Gradient Descent...
VSSML16 L8. Advanced Workflows: Feature Selection, Boosting, Gradient Descent...VSSML16 L8. Advanced Workflows: Feature Selection, Boosting, Gradient Descent...
VSSML16 L8. Advanced Workflows: Feature Selection, Boosting, Gradient Descent...
 
Logical replication with pglogical
Logical replication with pglogicalLogical replication with pglogical
Logical replication with pglogical
 
DA 592 - Term Project Report - Berker Kozan Can Koklu
DA 592 - Term Project Report - Berker Kozan Can KokluDA 592 - Term Project Report - Berker Kozan Can Koklu
DA 592 - Term Project Report - Berker Kozan Can Koklu
 
Validating Big Data Pipelines - Big Data Spain 2018
Validating Big Data Pipelines - Big Data Spain 2018Validating Big Data Pipelines - Big Data Spain 2018
Validating Big Data Pipelines - Big Data Spain 2018
 
Hadoop: Big Data Stacks validation w/ iTest How to tame the elephant?
Hadoop:  Big Data Stacks validation w/ iTest  How to tame the elephant?Hadoop:  Big Data Stacks validation w/ iTest  How to tame the elephant?
Hadoop: Big Data Stacks validation w/ iTest How to tame the elephant?
 
Contributing to Apache Spark 3
Contributing to Apache Spark 3Contributing to Apache Spark 3
Contributing to Apache Spark 3
 
Take A Gulp at Task Automation
Take A Gulp at Task AutomationTake A Gulp at Task Automation
Take A Gulp at Task Automation
 
Kubernetes - State of the Union (Q1-2016)
Kubernetes - State of the Union (Q1-2016)Kubernetes - State of the Union (Q1-2016)
Kubernetes - State of the Union (Q1-2016)
 

More from OLBATI

Geek Time Juillet 2017 : TDD coté Front/JS
Geek Time Juillet 2017 : TDD coté Front/JSGeek Time Juillet 2017 : TDD coté Front/JS
Geek Time Juillet 2017 : TDD coté Front/JSOLBATI
 
Geek Time Mai 2017 : Vue.js
Geek Time Mai 2017 : Vue.jsGeek Time Mai 2017 : Vue.js
Geek Time Mai 2017 : Vue.jsOLBATI
 
Geek Time Juin 2017 : Microservices Tracing
Geek Time Juin 2017 : Microservices TracingGeek Time Juin 2017 : Microservices Tracing
Geek Time Juin 2017 : Microservices TracingOLBATI
 
Geek Time Juin 2017 : GraphQL
Geek Time Juin 2017 : GraphQLGeek Time Juin 2017 : GraphQL
Geek Time Juin 2017 : GraphQLOLBATI
 
Geek Time Mars 2017 : Les microservices
Geek Time Mars 2017 : Les microservicesGeek Time Mars 2017 : Les microservices
Geek Time Mars 2017 : Les microservicesOLBATI
 
Geek Time Janvier 2017 : Quiz Java
Geek Time Janvier 2017 : Quiz JavaGeek Time Janvier 2017 : Quiz Java
Geek Time Janvier 2017 : Quiz JavaOLBATI
 
Geek Time Novembre 2016 : Quiz
Geek Time Novembre 2016 : QuizGeek Time Novembre 2016 : Quiz
Geek Time Novembre 2016 : QuizOLBATI
 
Geek Time Novembre 2016 : Neo4j
Geek Time Novembre 2016 : Neo4jGeek Time Novembre 2016 : Neo4j
Geek Time Novembre 2016 : Neo4jOLBATI
 
Geek Time September 2016 : JavaScript Linting Tools
Geek Time September 2016 : JavaScript Linting ToolsGeek Time September 2016 : JavaScript Linting Tools
Geek Time September 2016 : JavaScript Linting ToolsOLBATI
 
Geek Time Juin 2016 : Node.js
Geek Time Juin 2016 : Node.jsGeek Time Juin 2016 : Node.js
Geek Time Juin 2016 : Node.jsOLBATI
 
Geek Time Juin 2016 : React
Geek Time Juin 2016 : ReactGeek Time Juin 2016 : React
Geek Time Juin 2016 : ReactOLBATI
 

More from OLBATI (11)

Geek Time Juillet 2017 : TDD coté Front/JS
Geek Time Juillet 2017 : TDD coté Front/JSGeek Time Juillet 2017 : TDD coté Front/JS
Geek Time Juillet 2017 : TDD coté Front/JS
 
Geek Time Mai 2017 : Vue.js
Geek Time Mai 2017 : Vue.jsGeek Time Mai 2017 : Vue.js
Geek Time Mai 2017 : Vue.js
 
Geek Time Juin 2017 : Microservices Tracing
Geek Time Juin 2017 : Microservices TracingGeek Time Juin 2017 : Microservices Tracing
Geek Time Juin 2017 : Microservices Tracing
 
Geek Time Juin 2017 : GraphQL
Geek Time Juin 2017 : GraphQLGeek Time Juin 2017 : GraphQL
Geek Time Juin 2017 : GraphQL
 
Geek Time Mars 2017 : Les microservices
Geek Time Mars 2017 : Les microservicesGeek Time Mars 2017 : Les microservices
Geek Time Mars 2017 : Les microservices
 
Geek Time Janvier 2017 : Quiz Java
Geek Time Janvier 2017 : Quiz JavaGeek Time Janvier 2017 : Quiz Java
Geek Time Janvier 2017 : Quiz Java
 
Geek Time Novembre 2016 : Quiz
Geek Time Novembre 2016 : QuizGeek Time Novembre 2016 : Quiz
Geek Time Novembre 2016 : Quiz
 
Geek Time Novembre 2016 : Neo4j
Geek Time Novembre 2016 : Neo4jGeek Time Novembre 2016 : Neo4j
Geek Time Novembre 2016 : Neo4j
 
Geek Time September 2016 : JavaScript Linting Tools
Geek Time September 2016 : JavaScript Linting ToolsGeek Time September 2016 : JavaScript Linting Tools
Geek Time September 2016 : JavaScript Linting Tools
 
Geek Time Juin 2016 : Node.js
Geek Time Juin 2016 : Node.jsGeek Time Juin 2016 : Node.js
Geek Time Juin 2016 : Node.js
 
Geek Time Juin 2016 : React
Geek Time Juin 2016 : ReactGeek Time Juin 2016 : React
Geek Time Juin 2016 : React
 

Recently uploaded

%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benonimasabamasaba
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrandmasabamasaba
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastPapp Krisztián
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in sowetomasabamasaba
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...chiefasafspells
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfonteinmasabamasaba
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...masabamasaba
 
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open SourceWSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open SourceWSO2
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension AidPhilip Schwarz
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareJim McKeeth
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park masabamasaba
 
WSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2
 
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburgmasabamasaba
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyviewmasabamasaba
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfonteinmasabamasaba
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrainmasabamasaba
 
WSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaSWSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaSWSO2
 

Recently uploaded (20)

%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
 
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open SourceWSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
WSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security Program
 
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
WSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaSWSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaS
 

Geek Time Novembre 2016 : Cucumber

  • 1. Title geek time - Novembre 2016 HALLEB Khaled OLBATI Consultant
  • 2. OLBATI © 2016 - Geek Time November 2016 2 Cucumber? ● Tool for running automated tests ■ Support BDD ( using Gherkin language) ■ A single source of truth ■ Living documentation ■ Focus on the customer ■ Less rework
  • 3. OLBATI © 2016 - Geek Time November 2016 3 Cucumber and BDD ? ● Cucumber is for Behaviour-Driven Development
  • 4. OLBATI © 2016 - Geek Time November 2016 4 Gherkin ● Gherkin is plain-text English (or one of 60+ other languages) with a little extra structure ● Feature (Functionality) written in .feature files and defined by ● Feature − Name of the feature under test. ● Description (optional) − Describe about feature under test. ● Scenario − What is the test scenario. ● Steps
  • 5. OLBATI © 2016 - Geek Time November 2016 5 Gherkin ● Description Feature: <feature title> As a <persona|role> I want to <action> So that <outcome>
  • 6. OLBATI © 2016 - Geek Time November 2016 6 Gherkin ● Scenario A scenario is a concrete example that illustrates a business rule. It is a list of steps. You can have as many steps as you like, but we recommend you keep the number at 3-5 per scenario. If they become longer than that they lose their expressive power as specification and documentation.
  • 7. OLBATI © 2016 - Geek Time November 2016 7 Gherkin ● Step ● Given − Prerequisite before the test steps get executed. ● When − Specific condition which should match in order to execute the next step. ● Then − What should happen if the condition mentioned in WHEN is satisfied. If there are multiple Given or When steps underneath each other, you can use And or But
  • 8. OLBATI © 2016 - Geek Time November 2016 8 Gherkin ● Backgound Occasionally you'll find yourself repeating the same Given steps in all of the scenarios in a feature file. Since it is repeated in every scenario it is an indication that those steps are not essential to describe the scenarios, they are incidental details. You can literally move such Given steps to the background by grouping them under a Background section before the first scenario: Background: Given a $100 microwave was sold on 2015-11-03 And today is 2015-11-18
  • 9. OLBATI © 2016 - Geek Time November 2016 9 Gherkin ● Scenario Outline When you have a complex business rule with severable variable inputs or outputs you might end up creating several scenarios that only differ by their values. 1- Scenario: feeding a small suckler cow Given the cow weighs 450 kg When we calculate the feeding requirements Then the energy should be 26500 MJ And the protein should be 215 kg 2- Scenario: feeding a medium suckler cow Given the cow weighs 500 kg When we calculate the feeding requirements Then the energy should be 29500 MJ And the protein should be 245 kg #
  • 10. OLBATI © 2016 - Geek Time November 2016 10 Gherkin Scenario Outline: feeding a suckler cow Given the cow weighs <weight> kg When we calculate the feeding requirements Then the energy should be <energy> MJ And the protein should be <protein> kg Examples: | weight | energy | protein | | 450 | 26500 | 215 | | 500 | 29500 | 245 | | 575 | 31500 | 255 | | 600 | 37000 | 305 |
  • 11. OLBATI © 2016 - Geek Time November 2016 11 Gherkin ● Example A Scenario Outline section is always followed by one or more Examples sections, which are a container for a table. The table must have a header row corresponding to the variables in the Scenario Outline steps. Each of the rows below will create a new Scenario, filling in the variable values.
  • 12. OLBATI © 2016 - Geek Time November 2016 12 Gherkin ● Step Arguments In some cases you might want to pass a larger chunk of text or a table of data to a step---something that doesn't fit on a single line. For this purpose Gherkin has Doc Strings and Data Tables. Given a blog post named "Random" with Markdown body """ Some Title, Eh? =============== Here is the first paragraph of my blog post. Lorem ipsum dolor sit amet, consectetur adipiscing elit. """
  • 13. OLBATI © 2016 - Geek Time November 2016 13 Gherkin Given the following users exist: | name | email | twitter | | Aslak | aslak@cucumber.io | @aslak_hellesoy | | Julien | julien@cucumber.io | @jbpros | | Matt | matt@cucumber.io | @mattwynne |
  • 14. OLBATI © 2016 - Geek Time November 2016 14 Gherkin ● Tags Tags are a way to group Scenarios. They are @-prefixed strings and you can place as many tags as you like above Feature, Scenario, Scenario Outline or Examples keywords. Space character are invalid in tags and may separate them. Tags are inherited from parent elements. For example, if you place a tag above a Feature, all scenarios in that feature will get that tag.
  • 15. OLBATI © 2016 - Geek Time November 2016 15 Gherkin @tag1 @tag2 @tag3 Feature: name @RunWith(Cucumber.class) @Cucumber.Options(format = {"pretty", "html:target/cucumber"}, tags = {"~@tag1"}) public class runTest { }
  • 16. OLBATI © 2016 - Geek Time November 2016 16 Gherkin ● Comment we just need to put # before beginning your comment.
  • 17. OLBATI © 2016 - Geek Time November 2016 17 Step Definitions Cucumber doesn't know how to execute your scenarios out-of-the-box. It needs Step Definitions to translate plain text Gherkin steps into actions that will interact with the system.
  • 18. OLBATI © 2016 - Geek Time November 2016 18 Step Definitions public class OnesNumbersSteps { @Given("....(d+)$") public void the_menu_contains_the_following_dishes(final Integer quantity) {} @When("...") public void the_customer_order() {} @Then("^...$") public void the_result_should_be_I(){} }
  • 19. OLBATI © 2016 - Geek Time November 2016 19 Cucumber implementations ■ Ruby/JRuby ■ JRuby (using Cucumber-JVM) ■ Java ■ Groovy ■ JavaScript ■ JavaScript (using Cucumber-JVM and Rhino) ■ Clojure ■ Gosu ■ Lua ■ .NET (using SpecFlow) ■ PHP (using Behat) ■ Jython ■ C++ ■ Tcl
  • 20. OLBATI © 2016 - Geek Time November 2016 20 Cucumber-JVM ● Maven dependency <dependency> <groupId>info.cukes</groupId> <artifactId>cucumber-java</artifactId> <version>1.2.4-SNAPSHOT</version> <scope>test</scope> </dependency>
  • 21. OLBATI © 2016 - Geek Time November 2016 21 Running Cucumber ● JUnit Runner import cucumber.api.junit.Cucumber; import org.junit.runner.RunWith; @RunWith(Cucumber.class) public class RunCukesTest { }
  • 22. OLBATI © 2016 - Geek Time November 2016 22 Running Cucumber ● CLI Runner mvn test -Dcucumber.options="--help" will print out: Usage: java cucumber.api.cli.Main [options] [[[FILE|DIR][:LINE[:LINE]*] ]+ | @FILE ]
  • 23. OLBATI © 2016 - Geek Time November 2016 23 Running Cucumber ● Third party runners IntelliJ IDEA and Eclipse have plugins that can run scenarios from within an IDE: ■ IntelliJ IDEA ■ Cucumber-Eclipse
  • 24. OLBATI © 2016 - Geek Time November 2016 24 Kata : Arabic To Roman Numerals 1 = I 2 = II 3 = III 4 = IV 5 = V 6 = VI 7 = VII 8 = VIII 9 = IX 10 = X 20 = XX 30 = XXX 40 = XL 50 = L 60 = LX 70 = LXX 80 = LXXX 90 = XC 100 = C 500 = D 1000 = M 2000 = MM
  • 25. OLBATI © 2016 - Geek Time November 2016 25 Thanks! Any questions? halleb.khaled@gmail.com