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
 
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
 
2014 11 20 Drupal 7 -> 8 test migratie
2014 11 20 Drupal 7 -> 8 test migratie2014 11 20 Drupal 7 -> 8 test migratie
2014 11 20 Drupal 7 -> 8 test migratiehcderaad
 

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
 
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)
 
2014 11 20 Drupal 7 -> 8 test migratie
2014 11 20 Drupal 7 -> 8 test migratie2014 11 20 Drupal 7 -> 8 test migratie
2014 11 20 Drupal 7 -> 8 test migratie
 

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

Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)jennyeacort
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作qr0udbr0
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
How to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfHow to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfLivetecs LLC
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样umasea
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceBrainSell Technologies
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Matt Ray
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
Buds n Tech IT Solutions: Top-Notch Web Services in Noida
Buds n Tech IT Solutions: Top-Notch Web Services in NoidaBuds n Tech IT Solutions: Top-Notch Web Services in Noida
Buds n Tech IT Solutions: Top-Notch Web Services in Noidabntitsolutionsrishis
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 

Recently uploaded (20)

Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
How to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfHow to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdf
 
2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. Salesforce
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
Buds n Tech IT Solutions: Top-Notch Web Services in Noida
Buds n Tech IT Solutions: Top-Notch Web Services in NoidaBuds n Tech IT Solutions: Top-Notch Web Services in Noida
Buds n Tech IT Solutions: Top-Notch Web Services in Noida
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 

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