SlideShare a Scribd company logo
Cucumber(BDD Framework)
What is Cucumber?
 Cucumber is a testing approach which supports
Behavior Driven Development(BDD). It explains the
behavior of the application in the simple English text
using “Gherkin” language.
 Cucumber is a tool that supports Behavior Driven
Development(BDD).It offers a way to write tests that
anybody can understand, regardless of their technical
knowledge.
 Cucumber reads executable specifications written in
plain text and validates that the software does what
those specifications say. The specifications consists of
multiple examples, or scenarios
 Each scenario is a list of steps for Cucumber to work
through. Cucumber verifies that the software conforms
with the specification and generates a report
indicating ✅ success or ❌ failure for each scenario.
Advantages of Cucumber
 It is helpful to involve business stakeholders who can’t
easily read code.
 Cucumber Testing focuses on end-user experience.
 Style of writing tests allow for easier reuse of code in
the tests.
 Quick and easy setup and execution.
Install and download the Cucumber
 To install Cucumber open command prompt on your
machine and type the following command:
 “gem install cucumber”. The version vary depending on
the latest.
 Install bundler(is used to install gems in bundles)
 We also have options to download Cucumber in
Eclipse IDE and intelli J.
Gherkins
 Gherkins uses a set of special keyword to give structure
and meaning to executable specifications. Each
keyword is translated to many spoken languages; in
this reference we use “English”.
 Most lines in a Gherkin document start with one of the
keywords.
 In order for Cucumber to understand the scenarios,
they must follow some basic syntax rules, called
Gherkin.
Gherkin serves multiple purpose
 Unambiguous executable specification
 Automated testing using Cucumber
 Document how the system actually behaves
 Gherkin documents are stored in .feature text files and
are typically versioned in source control system like
Git,SVN.
Step Conditions
 Step definitions connect Gherkin steps to
programming code. A step definition carries out the
action that should be performed by the step. So step
definitions hard-wire the specification to the
implementation.
Steps in Gherkin--> matched with-->
Step Conditions-->manipulates-->System
Step definitions can be written in many programming
languages. Here is an example using JavaScript:
When("{maker} starts a game", function(maker) {
maker.startGameWithWord({ word: "whale" })
})
 A Step Definition is a Java method with an expression
that links it to one or more Gherkin steps. When
Cucumber executes a Gherkin step in a scenario, it will
look for a matching step definition to execute.
Expressions
 A step definition’s expression can either be a Regular
Expression or a Cucumber Expression. The examples in
this section use Cucumber Expressions. If you prefer to
use Regular Expressions, each capture group from the
match will be passed as arguments to the step
definition’s method.
The primary Keywords are
 Feature
 Scenario Outline / Scenario
 Steps: Given,When,Then,And and But
 Gherkin is localised for many spoken languages, each
has their own localised equivalent of these keywords.
Examples follow this pattern
 Describe an initial context (Given steps)
 Describe an event (When steps)
 Describe an expected outcome (Then steps)
Gherkin Keywords
Given
 Given steps are used to describe the initial context of
the system - the scene of the scenario. It is typically
something that happened in the past.
 When Cucumber executes a Given step, it will
configure the system to be in a well-defined state, such
as creating and configuring objects or adding data to a
test database.
Given
 The purpose of Given steps is to put the system in a
known state before the user (or external system) starts
interacting with the system (in the When steps). Avoid
talking about user interaction in Given’s. If you were
creating use cases, Given’s would be your preconditions.
Examples
 Minne and mansi have started the game
 I am logged in
 Joe has a balance of Euros 45.
When
 When steps are used to describe an event, or an
action. This can be a person interacting with the
system, or it can be an event triggered by another
system. It’s strongly recommended you only have a
single When step per Scenario. If you feel compelled to
add more, it’s usually a sign that you should split the
scenario up into multiple scenarios.
When
Examples
 Guess a word
 Invite a friend
 Withdraw money
Then
 Then steps are used to describe an expected outcome,
or result.
 The step definition of a Then step should use an
assertion to compare the actual outcome (what the
system actually does) to the expected outcome (what
the step says the system is supposed to do).
 An outcome should be on an observable output. That
is, something that comes out of the system (report,
user interface, message), and not a behaviour deeply
buried inside the system (like a record in a database).
Examples
 See that the guessed word was wrong
 Receive an invitation
 Card should be swallowed
And,But
 If you have successive Given’s, When’s, or Then’s, you
could write
Example
 Multiple Givens
 Given one thing
 Given another thing
 Given yet another thing
 When I open my eyes
 Then I should see something
 Then I shouldn't see something else
 Or, you could make the example more fluidly
structured by replacing the successive Given’s, When’s,
or Then’s with And’s and But’s:
Background
 Occasionally you’ll find yourself repeating the same
Given steps in all of the scenarios in a feature.
 Since it is repeated in every scenario, this 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.
 A Background allows you to add some context to the
scenarios in the feature. It can contain one or more
Given steps.
 A Background is run before each scenario, but after
any Before hooks. In your feature file, put the
Background before the first Scenario.
 You can only have one set of Background steps per
feature. If you need different Background steps for
different scenarios, you’ll need to split them into
different feature files.
Scenario Outline
 The Scenario Outline keyword can be used to run the
same Scenario multiple times, with different
combinations of values.
 The keyword Scenario Template is a synonym of the
keyword Scenario Outline.
Scenario1: eat 5 out of 12
 Given there are 12 cucumbers
 When I eat 5 cucumbers
 Then I should have 7 cucumbers
Scenario 2: eat 5 out of 20
 Given there are 20 cucumbers
 When I eat 5 cucumbers
 Then I should have 15 cucumbers
 We can collapse these two similar scenarios into a
Scenario Outline.
 Scenario outlines allow us to more concisely express
these scenarios through the use of a template with <
>-delimited parameters:
Scenario Outline: eating
 Given there are <start> cucumbers
 When I eat <eat> cucumbers
 Then I should have <left> cucumbers
Examples:
 | start | eat | left |
 | 12 | 5 | 7 |
 | 20 | 5 | 15 |
 A Scenario Outline must contain an Examples (or
Scenarios) section. Its steps are interpreted as a
template which is never directly run. Instead, the
Scenario Outline is run once for each row in the
Examples section beneath it (not counting the first
header row).
 The steps can use <> delimited parameters that
reference headers in the examples table. Cucumber will
replace these parameters with values from the table
before it tries to match the step against a step
definition.
Doc Strings
 Doc Strings are handy for passing a larger piece of text
to a Step Definition.
Step Arguments
 In some cases, you might pass the more data to a
step,than fits on a single line. For this purpose,
Gherkins has “Doc Strings”,”Data tables”.
 In Cucumber, an example is called a scenario. Scenarios
are defined in .feature files, which are stored in
src/test/resources/hellocucumber directory (or a
subdirectory).
Feature: Is it Friday yet?
Everybody wants to know when it’s Friday
Scenario: Sunday isn’t Friday
 Given today is Sunday
 When I ask whether it’s Friday yet
 Then I should be told “Nope”
 The first line of this file starts with the keyword Feature:
followed by a name. It’s a good idea to use a name
similar to the file name.
 The second line is a brief description of the feature.
 The fourth line, Scenario: Sunday is not Friday is a
scenario, which is a concrete example illustrating how
the software should behave.
 The last three lines starting with Given, When and Then
are the steps of our scenario. This is what Cucumber
will execute.
@Given("today is Sunday")
public void today_is_Sunday() {
// Write code here that turns the phrase above into
concrete actions
throw new io.cucumber.java.PendingException();
}
@When("I ask whether it's Friday yet")
public void i_ask_whether_it_s_Friday_yet() {
// Write code here that turns the phrase above into
concrete actions
throw new io.cucumber.java.PendingException();
}
@Then("I should be told {string}")
public void i_should_be_told(String string) {
// Write code here that turns the phrase above into
concrete actions
throw new io.cucumber.java.PendingException();
}
THANK YOU

More Related Content

PPTX
Cucumber BDD
Pravin Dsilva
 
PPTX
Introduction to Bdd and cucumber
Nibu Baby
 
PDF
BDD & Cucumber
Vladimir Arutin
 
PPTX
BDD WITH CUCUMBER AND JAVA
Srinivas Katakam
 
PPSX
Cucumber & gherkin language
selvanathankapilan
 
PDF
Selenium with Cucumber
Knoldus Inc.
 
PPTX
Test Automation Framework with BDD and Cucumber
Rhoynar Software Consulting
 
Cucumber BDD
Pravin Dsilva
 
Introduction to Bdd and cucumber
Nibu Baby
 
BDD & Cucumber
Vladimir Arutin
 
BDD WITH CUCUMBER AND JAVA
Srinivas Katakam
 
Cucumber & gherkin language
selvanathankapilan
 
Selenium with Cucumber
Knoldus Inc.
 
Test Automation Framework with BDD and Cucumber
Rhoynar Software Consulting
 

What's hot (20)

PPTX
Cucumber presenation
Oussama BEN WAFI
 
PDF
Cucumber ppt
Qwinix Technologies
 
PPTX
Automated Test Framework with Cucumber
Ramesh Krishnan Ganesan
 
PPTX
Automation test framework with cucumber – BDD
123abcda
 
PPTX
Bdd – with cucumber and gherkin
Arati Joshi
 
PDF
Behavior-Driven Development and Automation Testing Using Cucumber Framework W...
KMS Technology
 
PPTX
What Is Cucumber?
QATestLab
 
PPT
Selenium Concepts
Swati Bansal
 
ODP
BDD with Cucumber
Knoldus Inc.
 
PPTX
Automation Testing by Selenium Web Driver
Cuelogic Technologies Pvt. Ltd.
 
PPTX
Cucumber_Training_ForQA
Meenakshi Singhal
 
PPTX
Automation - web testing with selenium
Tzirla Rozental
 
PDF
Automation Testing using Selenium Webdriver
Pankaj Biswas
 
PPTX
Selenium
Batch2016
 
PDF
Selenium Automation Testing Interview Questions And Answers
Ajit Jadhav
 
PPTX
What Is Selenium? | Selenium Basics For Beginners | Introduction To Selenium ...
Simplilearn
 
ODP
Test Automation Framework using Cucumber BDD overview (part 1)
Mindfire Solutions
 
PPTX
Selenium Tutorial For Beginners | Selenium Automation Testing Tutorial | Sele...
Simplilearn
 
ODP
Selenium ppt
Anirudh Raja
 
PPTX
Introduction to Selenium Web Driver
Return on Intelligence
 
Cucumber presenation
Oussama BEN WAFI
 
Cucumber ppt
Qwinix Technologies
 
Automated Test Framework with Cucumber
Ramesh Krishnan Ganesan
 
Automation test framework with cucumber – BDD
123abcda
 
Bdd – with cucumber and gherkin
Arati Joshi
 
Behavior-Driven Development and Automation Testing Using Cucumber Framework W...
KMS Technology
 
What Is Cucumber?
QATestLab
 
Selenium Concepts
Swati Bansal
 
BDD with Cucumber
Knoldus Inc.
 
Automation Testing by Selenium Web Driver
Cuelogic Technologies Pvt. Ltd.
 
Cucumber_Training_ForQA
Meenakshi Singhal
 
Automation - web testing with selenium
Tzirla Rozental
 
Automation Testing using Selenium Webdriver
Pankaj Biswas
 
Selenium
Batch2016
 
Selenium Automation Testing Interview Questions And Answers
Ajit Jadhav
 
What Is Selenium? | Selenium Basics For Beginners | Introduction To Selenium ...
Simplilearn
 
Test Automation Framework using Cucumber BDD overview (part 1)
Mindfire Solutions
 
Selenium Tutorial For Beginners | Selenium Automation Testing Tutorial | Sele...
Simplilearn
 
Selenium ppt
Anirudh Raja
 
Introduction to Selenium Web Driver
Return on Intelligence
 
Ad

Similar to Cucumber presentation (20)

PPTX
Cucumber for automated acceptance testing.pptx
Kalhan Liyanage
 
PPTX
Cucumber jvm best practices v3
Ahmed Misbah
 
PDF
Master Cucumber cheat sheet for testing .pdf
ArunVastrad4
 
PPTX
Testing with cucumber testing framework
AIMDek Technologies
 
PDF
Advanced Test Automation: WDIO with BDD Cucumber
digitaljignect
 
PPTX
Cucumber With Selenium
Vishwanath KC
 
PPTX
presentation.pptx
AMINEADIB2
 
PDF
Geek Time Novembre 2016 : Cucumber
OLBATI
 
PPTX
Cucumber
Yıldız Orhan
 
PPTX
Xamariners - BDD + Mobile
Xamariners
 
PPTX
Introduction to Behaviour Driven Development (BDD) and Cucumber with Java
Jawad Khan
 
PPTX
BDD Selenium for Agile Teams - User Stories
Sauce Labs
 
PPT
Behavior Driven Development by Example
Nalin Goonawardana
 
PDF
cucumber harpal.pdf
VennelaVasupilli
 
PPTX
Test automation with Cucumber-JVM
Alan Parkinson
 
PPTX
The Art of Gherkin Scripting - Matt Eakin
QA or the Highway
 
PPTX
BDD with SpecFlow and Selenium
Liraz Shay
 
PDF
What is Gherkin or Cucumber testing.pdf
Riley Claire
 
Cucumber for automated acceptance testing.pptx
Kalhan Liyanage
 
Cucumber jvm best practices v3
Ahmed Misbah
 
Master Cucumber cheat sheet for testing .pdf
ArunVastrad4
 
Testing with cucumber testing framework
AIMDek Technologies
 
Advanced Test Automation: WDIO with BDD Cucumber
digitaljignect
 
Cucumber With Selenium
Vishwanath KC
 
presentation.pptx
AMINEADIB2
 
Geek Time Novembre 2016 : Cucumber
OLBATI
 
Cucumber
Yıldız Orhan
 
Xamariners - BDD + Mobile
Xamariners
 
Introduction to Behaviour Driven Development (BDD) and Cucumber with Java
Jawad Khan
 
BDD Selenium for Agile Teams - User Stories
Sauce Labs
 
Behavior Driven Development by Example
Nalin Goonawardana
 
cucumber harpal.pdf
VennelaVasupilli
 
Test automation with Cucumber-JVM
Alan Parkinson
 
The Art of Gherkin Scripting - Matt Eakin
QA or the Highway
 
BDD with SpecFlow and Selenium
Liraz Shay
 
What is Gherkin or Cucumber testing.pdf
Riley Claire
 
Ad

Recently uploaded (20)

PDF
GDG Cloud Munich - Intro - Luiz Carneiro - #BuildWithAI - July - Abdel.pdf
Luiz Carneiro
 
PDF
Accelerating Oracle Database 23ai Troubleshooting with Oracle AHF Fleet Insig...
Sandesh Rao
 
PDF
Responsible AI and AI Ethics - By Sylvester Ebhonu
Sylvester Ebhonu
 
PDF
CIFDAQ's Market Wrap : Bears Back in Control?
CIFDAQ
 
PDF
How ETL Control Logic Keeps Your Pipelines Safe and Reliable.pdf
Stryv Solutions Pvt. Ltd.
 
PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
PPTX
OA presentation.pptx OA presentation.pptx
pateldhruv002338
 
PDF
Software Development Methodologies in 2025
KodekX
 
PDF
Economic Impact of Data Centres to the Malaysian Economy
flintglobalapac
 
PPTX
The-Ethical-Hackers-Imperative-Safeguarding-the-Digital-Frontier.pptx
sujalchauhan1305
 
PDF
AI-Cloud-Business-Management-Platforms-The-Key-to-Efficiency-Growth.pdf
Artjoker Software Development Company
 
PPTX
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
PDF
NewMind AI Weekly Chronicles - July'25 - Week IV
NewMind AI
 
PPTX
IT Runs Better with ThousandEyes AI-driven Assurance
ThousandEyes
 
PDF
Research-Fundamentals-and-Topic-Development.pdf
ayesha butalia
 
PDF
Trying to figure out MCP by actually building an app from scratch with open s...
Julien SIMON
 
PDF
The Future of Artificial Intelligence (AI)
Mukul
 
PDF
The Future of Mobile Is Context-Aware—Are You Ready?
iProgrammer Solutions Private Limited
 
PDF
Automating ArcGIS Content Discovery with FME: A Real World Use Case
Safe Software
 
PDF
OFFOFFBOX™ – A New Era for African Film | Startup Presentation
ambaicciwalkerbrian
 
GDG Cloud Munich - Intro - Luiz Carneiro - #BuildWithAI - July - Abdel.pdf
Luiz Carneiro
 
Accelerating Oracle Database 23ai Troubleshooting with Oracle AHF Fleet Insig...
Sandesh Rao
 
Responsible AI and AI Ethics - By Sylvester Ebhonu
Sylvester Ebhonu
 
CIFDAQ's Market Wrap : Bears Back in Control?
CIFDAQ
 
How ETL Control Logic Keeps Your Pipelines Safe and Reliable.pdf
Stryv Solutions Pvt. Ltd.
 
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
OA presentation.pptx OA presentation.pptx
pateldhruv002338
 
Software Development Methodologies in 2025
KodekX
 
Economic Impact of Data Centres to the Malaysian Economy
flintglobalapac
 
The-Ethical-Hackers-Imperative-Safeguarding-the-Digital-Frontier.pptx
sujalchauhan1305
 
AI-Cloud-Business-Management-Platforms-The-Key-to-Efficiency-Growth.pdf
Artjoker Software Development Company
 
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
NewMind AI Weekly Chronicles - July'25 - Week IV
NewMind AI
 
IT Runs Better with ThousandEyes AI-driven Assurance
ThousandEyes
 
Research-Fundamentals-and-Topic-Development.pdf
ayesha butalia
 
Trying to figure out MCP by actually building an app from scratch with open s...
Julien SIMON
 
The Future of Artificial Intelligence (AI)
Mukul
 
The Future of Mobile Is Context-Aware—Are You Ready?
iProgrammer Solutions Private Limited
 
Automating ArcGIS Content Discovery with FME: A Real World Use Case
Safe Software
 
OFFOFFBOX™ – A New Era for African Film | Startup Presentation
ambaicciwalkerbrian
 

Cucumber presentation

  • 2. What is Cucumber?  Cucumber is a testing approach which supports Behavior Driven Development(BDD). It explains the behavior of the application in the simple English text using “Gherkin” language.  Cucumber is a tool that supports Behavior Driven Development(BDD).It offers a way to write tests that anybody can understand, regardless of their technical knowledge.
  • 3.  Cucumber reads executable specifications written in plain text and validates that the software does what those specifications say. The specifications consists of multiple examples, or scenarios  Each scenario is a list of steps for Cucumber to work through. Cucumber verifies that the software conforms with the specification and generates a report indicating ✅ success or ❌ failure for each scenario.
  • 4. Advantages of Cucumber  It is helpful to involve business stakeholders who can’t easily read code.  Cucumber Testing focuses on end-user experience.  Style of writing tests allow for easier reuse of code in the tests.  Quick and easy setup and execution.
  • 5. Install and download the Cucumber  To install Cucumber open command prompt on your machine and type the following command:  “gem install cucumber”. The version vary depending on the latest.  Install bundler(is used to install gems in bundles)  We also have options to download Cucumber in Eclipse IDE and intelli J.
  • 6. Gherkins  Gherkins uses a set of special keyword to give structure and meaning to executable specifications. Each keyword is translated to many spoken languages; in this reference we use “English”.  Most lines in a Gherkin document start with one of the keywords.  In order for Cucumber to understand the scenarios, they must follow some basic syntax rules, called Gherkin.
  • 7. Gherkin serves multiple purpose  Unambiguous executable specification  Automated testing using Cucumber  Document how the system actually behaves
  • 8.  Gherkin documents are stored in .feature text files and are typically versioned in source control system like Git,SVN. Step Conditions  Step definitions connect Gherkin steps to programming code. A step definition carries out the action that should be performed by the step. So step definitions hard-wire the specification to the implementation.
  • 9. Steps in Gherkin--> matched with--> Step Conditions-->manipulates-->System Step definitions can be written in many programming languages. Here is an example using JavaScript: When("{maker} starts a game", function(maker) { maker.startGameWithWord({ word: "whale" }) })
  • 10.  A Step Definition is a Java method with an expression that links it to one or more Gherkin steps. When Cucumber executes a Gherkin step in a scenario, it will look for a matching step definition to execute. Expressions  A step definition’s expression can either be a Regular Expression or a Cucumber Expression. The examples in this section use Cucumber Expressions. If you prefer to use Regular Expressions, each capture group from the match will be passed as arguments to the step definition’s method.
  • 11. The primary Keywords are  Feature  Scenario Outline / Scenario  Steps: Given,When,Then,And and But  Gherkin is localised for many spoken languages, each has their own localised equivalent of these keywords.
  • 12. Examples follow this pattern  Describe an initial context (Given steps)  Describe an event (When steps)  Describe an expected outcome (Then steps)
  • 13. Gherkin Keywords Given  Given steps are used to describe the initial context of the system - the scene of the scenario. It is typically something that happened in the past.  When Cucumber executes a Given step, it will configure the system to be in a well-defined state, such as creating and configuring objects or adding data to a test database.
  • 14. Given  The purpose of Given steps is to put the system in a known state before the user (or external system) starts interacting with the system (in the When steps). Avoid talking about user interaction in Given’s. If you were creating use cases, Given’s would be your preconditions. Examples  Minne and mansi have started the game  I am logged in  Joe has a balance of Euros 45.
  • 15. When  When steps are used to describe an event, or an action. This can be a person interacting with the system, or it can be an event triggered by another system. It’s strongly recommended you only have a single When step per Scenario. If you feel compelled to add more, it’s usually a sign that you should split the scenario up into multiple scenarios.
  • 16. When Examples  Guess a word  Invite a friend  Withdraw money
  • 17. Then  Then steps are used to describe an expected outcome, or result.  The step definition of a Then step should use an assertion to compare the actual outcome (what the system actually does) to the expected outcome (what the step says the system is supposed to do).
  • 18.  An outcome should be on an observable output. That is, something that comes out of the system (report, user interface, message), and not a behaviour deeply buried inside the system (like a record in a database). Examples  See that the guessed word was wrong  Receive an invitation  Card should be swallowed
  • 19. And,But  If you have successive Given’s, When’s, or Then’s, you could write Example  Multiple Givens  Given one thing  Given another thing
  • 20.  Given yet another thing  When I open my eyes  Then I should see something  Then I shouldn't see something else  Or, you could make the example more fluidly structured by replacing the successive Given’s, When’s, or Then’s with And’s and But’s:
  • 21. Background  Occasionally you’ll find yourself repeating the same Given steps in all of the scenarios in a feature.  Since it is repeated in every scenario, this 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.
  • 22.  A Background allows you to add some context to the scenarios in the feature. It can contain one or more Given steps.  A Background is run before each scenario, but after any Before hooks. In your feature file, put the Background before the first Scenario.  You can only have one set of Background steps per feature. If you need different Background steps for different scenarios, you’ll need to split them into different feature files.
  • 23. Scenario Outline  The Scenario Outline keyword can be used to run the same Scenario multiple times, with different combinations of values.  The keyword Scenario Template is a synonym of the keyword Scenario Outline.
  • 24. Scenario1: eat 5 out of 12  Given there are 12 cucumbers  When I eat 5 cucumbers  Then I should have 7 cucumbers Scenario 2: eat 5 out of 20  Given there are 20 cucumbers  When I eat 5 cucumbers  Then I should have 15 cucumbers
  • 25.  We can collapse these two similar scenarios into a Scenario Outline.  Scenario outlines allow us to more concisely express these scenarios through the use of a template with < >-delimited parameters:
  • 26. Scenario Outline: eating  Given there are <start> cucumbers  When I eat <eat> cucumbers  Then I should have <left> cucumbers Examples:  | start | eat | left |  | 12 | 5 | 7 |  | 20 | 5 | 15 |
  • 27.  A Scenario Outline must contain an Examples (or Scenarios) section. Its steps are interpreted as a template which is never directly run. Instead, the Scenario Outline is run once for each row in the Examples section beneath it (not counting the first header row).  The steps can use <> delimited parameters that reference headers in the examples table. Cucumber will replace these parameters with values from the table before it tries to match the step against a step definition.
  • 28. Doc Strings  Doc Strings are handy for passing a larger piece of text to a Step Definition. Step Arguments  In some cases, you might pass the more data to a step,than fits on a single line. For this purpose, Gherkins has “Doc Strings”,”Data tables”.
  • 29.  In Cucumber, an example is called a scenario. Scenarios are defined in .feature files, which are stored in src/test/resources/hellocucumber directory (or a subdirectory). Feature: Is it Friday yet? Everybody wants to know when it’s Friday Scenario: Sunday isn’t Friday  Given today is Sunday  When I ask whether it’s Friday yet  Then I should be told “Nope”
  • 30.  The first line of this file starts with the keyword Feature: followed by a name. It’s a good idea to use a name similar to the file name.  The second line is a brief description of the feature.  The fourth line, Scenario: Sunday is not Friday is a scenario, which is a concrete example illustrating how the software should behave.
  • 31.  The last three lines starting with Given, When and Then are the steps of our scenario. This is what Cucumber will execute. @Given("today is Sunday") public void today_is_Sunday() { // Write code here that turns the phrase above into concrete actions throw new io.cucumber.java.PendingException(); }
  • 32. @When("I ask whether it's Friday yet") public void i_ask_whether_it_s_Friday_yet() { // Write code here that turns the phrase above into concrete actions throw new io.cucumber.java.PendingException(); }
  • 33. @Then("I should be told {string}") public void i_should_be_told(String string) { // Write code here that turns the phrase above into concrete actions throw new io.cucumber.java.PendingException(); }