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

What's hot

Cucumber presenation
Cucumber presenationCucumber presenation
Cucumber presenation
Oussama BEN WAFI
 
Cucumber ppt
Cucumber pptCucumber ppt
Cucumber ppt
Qwinix Technologies
 
Test Automation Framework using Cucumber BDD overview (part 1)
Test Automation Framework using Cucumber BDD overview (part 1)Test Automation Framework using Cucumber BDD overview (part 1)
Test Automation Framework using Cucumber BDD overview (part 1)
Mindfire Solutions
 
Introduction to BDD with Cucumber for Java
Introduction to BDD with Cucumber for JavaIntroduction to BDD with Cucumber for Java
Introduction to BDD with Cucumber for Java
Seb Rose
 
Automation test framework with cucumber – BDD
Automation test framework with cucumber – BDDAutomation test framework with cucumber – BDD
Automation test framework with cucumber – BDD
123abcda
 
BDD & Cucumber
BDD & CucumberBDD & Cucumber
BDD & Cucumber
Vladimir Arutin
 
Automated Test Framework with Cucumber
Automated Test Framework with CucumberAutomated Test Framework with Cucumber
Automated Test Framework with Cucumber
Ramesh Krishnan Ganesan
 
BDD testing with cucumber
BDD testing with cucumberBDD testing with cucumber
BDD testing with cucumber
Daniel Kummer
 
Gherkin /BDD intro
Gherkin /BDD introGherkin /BDD intro
Test Automation Framework with BDD and Cucumber
Test Automation Framework with BDD and CucumberTest Automation Framework with BDD and Cucumber
Test Automation Framework with BDD and Cucumber
Rhoynar Software Consulting
 
Selenium Automation Testing Interview Questions And Answers
Selenium Automation Testing Interview Questions And AnswersSelenium Automation Testing Interview Questions And Answers
Selenium Automation Testing Interview Questions And Answers
Ajit Jadhav
 
Behavior Driven Development and Automation Testing Using Cucumber
Behavior Driven Development and Automation Testing Using CucumberBehavior Driven Development and Automation Testing Using Cucumber
Behavior Driven Development and Automation Testing Using Cucumber
KMS Technology
 
Angular kickstart slideshare
Angular kickstart   slideshareAngular kickstart   slideshare
Angular kickstart slideshare
SaleemMalik52
 
Bdd Introduction
Bdd IntroductionBdd Introduction
Bdd Introduction
Skills Matter
 
Webdriver io presentation
Webdriver io presentationWebdriver io presentation
Webdriver io presentation
João Nabais
 
Testing with Express, Mocha & Chai
Testing with Express, Mocha & ChaiTesting with Express, Mocha & Chai
Testing with Express, Mocha & Chai
Joerg Henning
 
Specification-By-Example with Gherkin
Specification-By-Example with GherkinSpecification-By-Example with Gherkin
Specification-By-Example with Gherkin
Christian Hassa
 
Gatling
Gatling Gatling
Gatling
Gaurav Shukla
 
Test and Behaviour Driven Development (TDD/BDD)
Test and Behaviour Driven Development (TDD/BDD)Test and Behaviour Driven Development (TDD/BDD)
Test and Behaviour Driven Development (TDD/BDD)
Lars Thorup
 
Unit Testing in Java
Unit Testing in JavaUnit Testing in Java
Unit Testing in Java
Ahmed M. Gomaa
 

What's hot (20)

Cucumber presenation
Cucumber presenationCucumber presenation
Cucumber presenation
 
Cucumber ppt
Cucumber pptCucumber ppt
Cucumber ppt
 
Test Automation Framework using Cucumber BDD overview (part 1)
Test Automation Framework using Cucumber BDD overview (part 1)Test Automation Framework using Cucumber BDD overview (part 1)
Test Automation Framework using Cucumber BDD overview (part 1)
 
Introduction to BDD with Cucumber for Java
Introduction to BDD with Cucumber for JavaIntroduction to BDD with Cucumber for Java
Introduction to BDD with Cucumber for Java
 
Automation test framework with cucumber – BDD
Automation test framework with cucumber – BDDAutomation test framework with cucumber – BDD
Automation test framework with cucumber – BDD
 
BDD & Cucumber
BDD & CucumberBDD & Cucumber
BDD & Cucumber
 
Automated Test Framework with Cucumber
Automated Test Framework with CucumberAutomated Test Framework with Cucumber
Automated Test Framework with Cucumber
 
BDD testing with cucumber
BDD testing with cucumberBDD testing with cucumber
BDD testing with cucumber
 
Gherkin /BDD intro
Gherkin /BDD introGherkin /BDD intro
Gherkin /BDD intro
 
Test Automation Framework with BDD and Cucumber
Test Automation Framework with BDD and CucumberTest Automation Framework with BDD and Cucumber
Test Automation Framework with BDD and Cucumber
 
Selenium Automation Testing Interview Questions And Answers
Selenium Automation Testing Interview Questions And AnswersSelenium Automation Testing Interview Questions And Answers
Selenium Automation Testing Interview Questions And Answers
 
Behavior Driven Development and Automation Testing Using Cucumber
Behavior Driven Development and Automation Testing Using CucumberBehavior Driven Development and Automation Testing Using Cucumber
Behavior Driven Development and Automation Testing Using Cucumber
 
Angular kickstart slideshare
Angular kickstart   slideshareAngular kickstart   slideshare
Angular kickstart slideshare
 
Bdd Introduction
Bdd IntroductionBdd Introduction
Bdd Introduction
 
Webdriver io presentation
Webdriver io presentationWebdriver io presentation
Webdriver io presentation
 
Testing with Express, Mocha & Chai
Testing with Express, Mocha & ChaiTesting with Express, Mocha & Chai
Testing with Express, Mocha & Chai
 
Specification-By-Example with Gherkin
Specification-By-Example with GherkinSpecification-By-Example with Gherkin
Specification-By-Example with Gherkin
 
Gatling
Gatling Gatling
Gatling
 
Test and Behaviour Driven Development (TDD/BDD)
Test and Behaviour Driven Development (TDD/BDD)Test and Behaviour Driven Development (TDD/BDD)
Test and Behaviour Driven Development (TDD/BDD)
 
Unit Testing in Java
Unit Testing in JavaUnit Testing in Java
Unit Testing in Java
 

Similar to Cucumber presentation

How to fix bug or defects in software
How to fix bug or defects in software How to fix bug or defects in software
How to fix bug or defects in software
Rajasekar Subramanian
 
BDD with SpecFlow and Selenium
BDD with SpecFlow and SeleniumBDD with SpecFlow and Selenium
BDD with SpecFlow and Selenium
Liraz Shay
 
Neo4j Stored Procedure Training Part 1
Neo4j Stored Procedure Training Part 1Neo4j Stored Procedure Training Part 1
Neo4j Stored Procedure Training Part 1
Max De Marzi
 
Cucumber
CucumberCucumber
Cucumber
Yıldız Orhan
 
Working Effectively With Legacy Code
Working Effectively With Legacy CodeWorking Effectively With Legacy Code
Working Effectively With Legacy Code
Naresh Jain
 
Cucumber for automated acceptance testing.pptx
Cucumber for automated acceptance testing.pptxCucumber for automated acceptance testing.pptx
Cucumber for automated acceptance testing.pptx
Kalhan Liyanage
 
BDD using Cucumber JVM
BDD using Cucumber JVMBDD using Cucumber JVM
BDD using Cucumber JVM
Vijay Krishnan Ramaswamy
 
Testing Options in Java
Testing Options in JavaTesting Options in Java
Testing Options in Java
Michael Fons
 
PHPConf.asia 2016 - BDD with Behat for Beginners
PHPConf.asia 2016 - BDD with Behat for BeginnersPHPConf.asia 2016 - BDD with Behat for Beginners
PHPConf.asia 2016 - BDD with Behat for Beginners
Adam Englander
 
Behavior Driven Development by Example
Behavior Driven Development by ExampleBehavior Driven Development by Example
Behavior Driven Development by Example
Nalin Goonawardana
 
Debugging NET Applications With WinDBG
Debugging  NET Applications With WinDBGDebugging  NET Applications With WinDBG
Debugging NET Applications With WinDBG
Cory Foy
 
The Art Of Debugging
The Art Of DebuggingThe Art Of Debugging
The Art Of Debugging
svilen.ivanov
 
Testing Hourglass at Jira Frontend - by Alexey Shpakov, Sr. Developer @ Atlas...
Testing Hourglass at Jira Frontend - by Alexey Shpakov, Sr. Developer @ Atlas...Testing Hourglass at Jira Frontend - by Alexey Shpakov, Sr. Developer @ Atlas...
Testing Hourglass at Jira Frontend - by Alexey Shpakov, Sr. Developer @ Atlas...
Applitools
 
A la découverte des google/mock (aka gmock)
A la découverte des google/mock (aka gmock)A la découverte des google/mock (aka gmock)
A la découverte des google/mock (aka gmock)
Thierry Gayet
 
Testing Experience - Evolution of Test Automation Frameworks
Testing Experience - Evolution of Test Automation FrameworksTesting Experience - Evolution of Test Automation Frameworks
Testing Experience - Evolution of Test Automation Frameworks
Łukasz Morawski
 
Zend con 2016 bdd with behat for beginners
Zend con 2016   bdd with behat for beginnersZend con 2016   bdd with behat for beginners
Zend con 2016 bdd with behat for beginners
Adam Englander
 
Professional JavaScript: AntiPatterns
Professional JavaScript: AntiPatternsProfessional JavaScript: AntiPatterns
Professional JavaScript: AntiPatterns
Mike Wilcox
 
BDD Testing Using Godog - Bangalore Golang Meetup # 32
BDD Testing Using Godog - Bangalore Golang Meetup # 32BDD Testing Using Godog - Bangalore Golang Meetup # 32
BDD Testing Using Godog - Bangalore Golang Meetup # 32
OpenEBS
 
Behaviour Driven Development
Behaviour Driven DevelopmentBehaviour Driven Development
Behaviour Driven Development
Andy Kelk
 
JavaScript - Chapter 15 - Debugging Techniques
 JavaScript - Chapter 15 - Debugging Techniques JavaScript - Chapter 15 - Debugging Techniques
JavaScript - Chapter 15 - Debugging Techniques
WebStackAcademy
 

Similar to Cucumber presentation (20)

How to fix bug or defects in software
How to fix bug or defects in software How to fix bug or defects in software
How to fix bug or defects in software
 
BDD with SpecFlow and Selenium
BDD with SpecFlow and SeleniumBDD with SpecFlow and Selenium
BDD with SpecFlow and Selenium
 
Neo4j Stored Procedure Training Part 1
Neo4j Stored Procedure Training Part 1Neo4j Stored Procedure Training Part 1
Neo4j Stored Procedure Training Part 1
 
Cucumber
CucumberCucumber
Cucumber
 
Working Effectively With Legacy Code
Working Effectively With Legacy CodeWorking Effectively With Legacy Code
Working Effectively With Legacy Code
 
Cucumber for automated acceptance testing.pptx
Cucumber for automated acceptance testing.pptxCucumber for automated acceptance testing.pptx
Cucumber for automated acceptance testing.pptx
 
BDD using Cucumber JVM
BDD using Cucumber JVMBDD using Cucumber JVM
BDD using Cucumber JVM
 
Testing Options in Java
Testing Options in JavaTesting Options in Java
Testing Options in Java
 
PHPConf.asia 2016 - BDD with Behat for Beginners
PHPConf.asia 2016 - BDD with Behat for BeginnersPHPConf.asia 2016 - BDD with Behat for Beginners
PHPConf.asia 2016 - BDD with Behat for Beginners
 
Behavior Driven Development by Example
Behavior Driven Development by ExampleBehavior Driven Development by Example
Behavior Driven Development by Example
 
Debugging NET Applications With WinDBG
Debugging  NET Applications With WinDBGDebugging  NET Applications With WinDBG
Debugging NET Applications With WinDBG
 
The Art Of Debugging
The Art Of DebuggingThe Art Of Debugging
The Art Of Debugging
 
Testing Hourglass at Jira Frontend - by Alexey Shpakov, Sr. Developer @ Atlas...
Testing Hourglass at Jira Frontend - by Alexey Shpakov, Sr. Developer @ Atlas...Testing Hourglass at Jira Frontend - by Alexey Shpakov, Sr. Developer @ Atlas...
Testing Hourglass at Jira Frontend - by Alexey Shpakov, Sr. Developer @ Atlas...
 
A la découverte des google/mock (aka gmock)
A la découverte des google/mock (aka gmock)A la découverte des google/mock (aka gmock)
A la découverte des google/mock (aka gmock)
 
Testing Experience - Evolution of Test Automation Frameworks
Testing Experience - Evolution of Test Automation FrameworksTesting Experience - Evolution of Test Automation Frameworks
Testing Experience - Evolution of Test Automation Frameworks
 
Zend con 2016 bdd with behat for beginners
Zend con 2016   bdd with behat for beginnersZend con 2016   bdd with behat for beginners
Zend con 2016 bdd with behat for beginners
 
Professional JavaScript: AntiPatterns
Professional JavaScript: AntiPatternsProfessional JavaScript: AntiPatterns
Professional JavaScript: AntiPatterns
 
BDD Testing Using Godog - Bangalore Golang Meetup # 32
BDD Testing Using Godog - Bangalore Golang Meetup # 32BDD Testing Using Godog - Bangalore Golang Meetup # 32
BDD Testing Using Godog - Bangalore Golang Meetup # 32
 
Behaviour Driven Development
Behaviour Driven DevelopmentBehaviour Driven Development
Behaviour Driven Development
 
JavaScript - Chapter 15 - Debugging Techniques
 JavaScript - Chapter 15 - Debugging Techniques JavaScript - Chapter 15 - Debugging Techniques
JavaScript - Chapter 15 - Debugging Techniques
 

Recently uploaded

Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
tolgahangng
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
Neo4j
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
Uni Systems S.M.S.A.
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
Tomaz Bratanic
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
Quotidiano Piemontese
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
KAMESHS29
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
Neo4j
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
Matthew Sinclair
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems S.M.S.A.
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Speck&Tech
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
shyamraj55
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
panagenda
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
innovationoecd
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
Neo4j
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
SOFTTECHHUB
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
Pixlogix Infotech
 

Recently uploaded (20)

Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
 

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(); }