SlideShare a Scribd company logo
3
Most read
4
Most read
11
Most read
An Introduction to BDD, BDD Framework, Gherkins, BDD tools and Feature file
Presented By,
Rohit Bisht
Associate Business Analyst
Contents
• Behavior Driven Development (BDD)
• Features of BDD
• BDD Tools
• BDD Framework
• Examples of Cucumber/SpecFlow/BDD test
• Gherkin – BDD Language
• The Problem
• Example of Gherkin
• The Conclusion
• SpecFlow Feature File
• Keywords for the Feature File creation
Please refer the Notes at the bottom, I have explained it in detail for almost all the Slides and have given
the links for reference as well.
Behavior Driven Development
(BDD)
Behavior Driven testing is an extension of TDD. Like in TDD in BDD
also we write tests first and the add application code. The major
difference that we get to see here are
• Tests are written in plain descriptive English type grammar
• Tests are explained as behavior of application and are more user
focused
• Using examples to clarify requirements
• This difference brings in the need to have a language which can
define, in an understandable format.
Features of BDD
• Shifting from thinking in “tests” to thinking in “behavior”
• Collaboration between Business stakeholders, Business Analysts,
QA Team and developers
• Ubiquitous language, it is easy to describe
• Driven by Business Value
• Extends Test Driven Development (TDD) by utilizing natural
language that non technical stakeholders can understand
• BDD frameworks such as Cucumber or JBehave are an enabler,
acting a “bridge” between Business & Technical Language
BDD Tools
• Cucumber
• SpecFlow
Why BDD Framework?
Example of a
Cucumber/SpecFlow/BDD Test:
Feature: Sign up
Sign up should be quick and friendly.
Scenario: Successful sign up
New users should get a confirmation email and be greeted
personally by the site once signed in.
Given I have chosen to sign up
When I sign up with valid details
Then I should receive a confirmation email
And I should see a personalized greeting message
Scenario: Duplicate email
Where someone tries to create an account for an email address
that already exists.
Given I have chosen to sign up
But I enter an email address that has already registered
Then I should be told that the email is already registered
And I should be offered the option to recover my password
What is Gherkin – BDD Language?
Gherkin is a simple, lightweight and structured language which uses
regular spoken language to describe requirements and scenarios.
By regular spoken language we mean English, French and around
30 more languages.
The Problem
• Business team and the technical teams are communicating at two
different levels, business team being vague and technical team
trying to be precise.
• Not enough insight being given to the Business team, so that they
could have come up with new scenarios.
• Some details of project being lost in emails and telephonic
conversations.
Example of Gherkin
As Gherkin is a structured language it follows some syntax let us first
see a simple scenario described in gherkin.
Feature: Search feature for users
This feature is very important because it will allow users to filter
products
Scenario: When a user searches, without spelling mistake, for a
product name present in inventory. All the products with similar
name should be displayed
Given User is on the main page of www.myshopingsite.com
When User searches for laptops
Then search page should be updated with the lists of laptops
The Conclusion
• Different teams in the project need a common language to express
requirements. This language should be simple enough to be
understood by Business team members and should be explicit
enough to remove most of the ambiguities for developers and
testers.
• This language should open up the thinking of team members to
come up with more scenarios. As you express more details you try
to visualize the system more and hence you end up making more
user scenarios.
• This language should be good enough to be used as project
documentation
What is SpecFlow Feature File?
A feature file is an entry point to the SpecFlow test. This is a file
where you will describe your tests in Descriptive language (Like
English). It is an essential part of SpecFlow, as it serves as an
automation test script as well as live documents. A feature file can
contain a scenario or can contain many scenarios in a single feature
file but it usually contains a list of scenarios.
Keywords
Now moving forward we have just defined a test. You will notice colored
part of the tests (Feature, Scenario, Given, When, And and Then). These
are keywords defined by Gherkin. Gherkin has more keywords and we
will discuss those in following tutorials. But to start off we can quickly
explain some of the keywords in one line. Note this is not complete listing
of Keywords:
Feature: Defines what feature you will be testing in the tests below
Given: Tells the pre-condition of the test
And: Defines additional conditions of the test
When: Defines the action of the test
Then: States the post condition. You can say that it is expected result of the
test
Thank You
Links at the notes for reference.

More Related Content

ODP
BDD with Cucumber
ODP
Introduction to BDD
PPTX
BDD presentation
PDF
Successfully Implementing BDD in an Agile World
PPTX
Test Automation Framework with BDD and Cucumber
PPTX
Introduction to Bdd and cucumber
PPTX
Automation test framework with cucumber – BDD
PDF
Selenium with Cucumber
BDD with Cucumber
Introduction to BDD
BDD presentation
Successfully Implementing BDD in an Agile World
Test Automation Framework with BDD and Cucumber
Introduction to Bdd and cucumber
Automation test framework with cucumber – BDD
Selenium with Cucumber

What's hot (20)

PDF
BDD & Cucumber
ODP
Test Automation Framework using Cucumber BDD overview (part 1)
PDF
An introduction to Behavior-Driven Development (BDD)
PPTX
BDD WITH CUCUMBER AND JAVA
PPTX
Cucumber BDD
PPTX
Using Specflow for BDD
PDF
Bdd Introduction
PDF
Test and Behaviour Driven Development (TDD/BDD)
PDF
Introduction to BDD with Cucumber for Java
PPT
Agile testing
PDF
Introducing BDD and TDD with Cucumber
PDF
Introduction to CICD
PPTX
Sanity testing and smoke testing
PPTX
Agile Testing and Test Automation
PPTX
Breaking down agile requirements in Agile Methodology
PPTX
Cucumber presenation
PDF
An Introduction to Test Driven Development
PPTX
Introducing Swagger
PDF
Introduction to GitHub Actions
BDD & Cucumber
Test Automation Framework using Cucumber BDD overview (part 1)
An introduction to Behavior-Driven Development (BDD)
BDD WITH CUCUMBER AND JAVA
Cucumber BDD
Using Specflow for BDD
Bdd Introduction
Test and Behaviour Driven Development (TDD/BDD)
Introduction to BDD with Cucumber for Java
Agile testing
Introducing BDD and TDD with Cucumber
Introduction to CICD
Sanity testing and smoke testing
Agile Testing and Test Automation
Breaking down agile requirements in Agile Methodology
Cucumber presenation
An Introduction to Test Driven Development
Introducing Swagger
Introduction to GitHub Actions
Ad

Similar to Behavior driven development (bdd) (20)

PDF
Implement BDD with Cucumber and SpecFlow
PDF
Scrum Bangalore 13th meet up 13 june 2015 - behaviour driven development - vi...
PPTX
Cucumber With Selenium
PPTX
Behaviour Driven BizTalk Development
PDF
Spec(ing) Out Your Workflow with SpecFlow
PPTX
Introduction to Test Driven Development
PDF
Journey to Testable Requirements
PPTX
BDD 001 behavoir draven delopment ts.pptx
PPTX
Web Automation with BDD framework using Seleniummm
PPTX
Web Automation with BDD framework using Selenium
PDF
Lessons learned with Bdd: a tutorial
PPTX
Introduction to Testing and TDD
PDF
An Introduction to Behaviour Driven Development with Cucumber Java
PDF
Introduction to BDD (Behavior-Driven Development)
PPTX
Gherkin for test automation in agile
PPTX
Introduction to Behaviour Driven Development (BDD) and Cucumber with Java
PPTX
Bdd with Visual Studio 2010, Spec Flow and WatiN
PDF
Behavior Driven Development
Implement BDD with Cucumber and SpecFlow
Scrum Bangalore 13th meet up 13 june 2015 - behaviour driven development - vi...
Cucumber With Selenium
Behaviour Driven BizTalk Development
Spec(ing) Out Your Workflow with SpecFlow
Introduction to Test Driven Development
Journey to Testable Requirements
BDD 001 behavoir draven delopment ts.pptx
Web Automation with BDD framework using Seleniummm
Web Automation with BDD framework using Selenium
Lessons learned with Bdd: a tutorial
Introduction to Testing and TDD
An Introduction to Behaviour Driven Development with Cucumber Java
Introduction to BDD (Behavior-Driven Development)
Gherkin for test automation in agile
Introduction to Behaviour Driven Development (BDD) and Cucumber with Java
Bdd with Visual Studio 2010, Spec Flow and WatiN
Behavior Driven Development
Ad

More from Rohit Bisht (11)

PPTX
Team building
PPTX
Business engagement template
PPTX
Health care analytics
PPTX
SQL: Structured Query Language
PPTX
Geomatics
PPTX
Oil and Gas: Upstream
DOCX
An overview of cng and png
DOCX
Problem of odor pollution and its management solution
PPTX
Effects of the falling price on the global economy
PPTX
Demmergers hero honda split
PPTX
Maintenance Management
Team building
Business engagement template
Health care analytics
SQL: Structured Query Language
Geomatics
Oil and Gas: Upstream
An overview of cng and png
Problem of odor pollution and its management solution
Effects of the falling price on the global economy
Demmergers hero honda split
Maintenance Management

Recently uploaded (20)

PDF
System and Network Administraation Chapter 3
PPTX
CHAPTER 12 - CYBER SECURITY AND FUTURE SKILLS (1) (1).pptx
PPTX
Introduction to Artificial Intelligence
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PPTX
Transform Your Business with a Software ERP System
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PPTX
ai tools demonstartion for schools and inter college
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PDF
Understanding Forklifts - TECH EHS Solution
PPTX
CHAPTER 2 - PM Management and IT Context
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PDF
How Creative Agencies Leverage Project Management Software.pdf
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PDF
AI in Product Development-omnex systems
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
System and Network Administraation Chapter 3
CHAPTER 12 - CYBER SECURITY AND FUTURE SKILLS (1) (1).pptx
Introduction to Artificial Intelligence
Which alternative to Crystal Reports is best for small or large businesses.pdf
Transform Your Business with a Software ERP System
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
ai tools demonstartion for schools and inter college
Design an Analysis of Algorithms I-SECS-1021-03
Understanding Forklifts - TECH EHS Solution
CHAPTER 2 - PM Management and IT Context
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
How to Choose the Right IT Partner for Your Business in Malaysia
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Upgrade and Innovation Strategies for SAP ERP Customers
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
How Creative Agencies Leverage Project Management Software.pdf
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
AI in Product Development-omnex systems
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool

Behavior driven development (bdd)

  • 1. An Introduction to BDD, BDD Framework, Gherkins, BDD tools and Feature file Presented By, Rohit Bisht Associate Business Analyst
  • 2. Contents • Behavior Driven Development (BDD) • Features of BDD • BDD Tools • BDD Framework • Examples of Cucumber/SpecFlow/BDD test • Gherkin – BDD Language • The Problem • Example of Gherkin • The Conclusion • SpecFlow Feature File • Keywords for the Feature File creation Please refer the Notes at the bottom, I have explained it in detail for almost all the Slides and have given the links for reference as well.
  • 3. Behavior Driven Development (BDD) Behavior Driven testing is an extension of TDD. Like in TDD in BDD also we write tests first and the add application code. The major difference that we get to see here are • Tests are written in plain descriptive English type grammar • Tests are explained as behavior of application and are more user focused • Using examples to clarify requirements • This difference brings in the need to have a language which can define, in an understandable format.
  • 4. Features of BDD • Shifting from thinking in “tests” to thinking in “behavior” • Collaboration between Business stakeholders, Business Analysts, QA Team and developers • Ubiquitous language, it is easy to describe • Driven by Business Value • Extends Test Driven Development (TDD) by utilizing natural language that non technical stakeholders can understand • BDD frameworks such as Cucumber or JBehave are an enabler, acting a “bridge” between Business & Technical Language
  • 7. Example of a Cucumber/SpecFlow/BDD Test: Feature: Sign up Sign up should be quick and friendly. Scenario: Successful sign up New users should get a confirmation email and be greeted personally by the site once signed in. Given I have chosen to sign up When I sign up with valid details Then I should receive a confirmation email And I should see a personalized greeting message Scenario: Duplicate email Where someone tries to create an account for an email address that already exists. Given I have chosen to sign up But I enter an email address that has already registered Then I should be told that the email is already registered And I should be offered the option to recover my password
  • 8. What is Gherkin – BDD Language? Gherkin is a simple, lightweight and structured language which uses regular spoken language to describe requirements and scenarios. By regular spoken language we mean English, French and around 30 more languages.
  • 9. The Problem • Business team and the technical teams are communicating at two different levels, business team being vague and technical team trying to be precise. • Not enough insight being given to the Business team, so that they could have come up with new scenarios. • Some details of project being lost in emails and telephonic conversations.
  • 10. Example of Gherkin As Gherkin is a structured language it follows some syntax let us first see a simple scenario described in gherkin. Feature: Search feature for users This feature is very important because it will allow users to filter products Scenario: When a user searches, without spelling mistake, for a product name present in inventory. All the products with similar name should be displayed Given User is on the main page of www.myshopingsite.com When User searches for laptops Then search page should be updated with the lists of laptops
  • 11. The Conclusion • Different teams in the project need a common language to express requirements. This language should be simple enough to be understood by Business team members and should be explicit enough to remove most of the ambiguities for developers and testers. • This language should open up the thinking of team members to come up with more scenarios. As you express more details you try to visualize the system more and hence you end up making more user scenarios. • This language should be good enough to be used as project documentation
  • 12. What is SpecFlow Feature File? A feature file is an entry point to the SpecFlow test. This is a file where you will describe your tests in Descriptive language (Like English). It is an essential part of SpecFlow, as it serves as an automation test script as well as live documents. A feature file can contain a scenario or can contain many scenarios in a single feature file but it usually contains a list of scenarios.
  • 13. Keywords Now moving forward we have just defined a test. You will notice colored part of the tests (Feature, Scenario, Given, When, And and Then). These are keywords defined by Gherkin. Gherkin has more keywords and we will discuss those in following tutorials. But to start off we can quickly explain some of the keywords in one line. Note this is not complete listing of Keywords: Feature: Defines what feature you will be testing in the tests below Given: Tells the pre-condition of the test And: Defines additional conditions of the test When: Defines the action of the test Then: States the post condition. You can say that it is expected result of the test
  • 14. Thank You Links at the notes for reference.

Editor's Notes

  • #4: TDD is test centered development process in which we start writing tests firsts. Initially these tests fails but as we add more application code these tests pass. This helps us in many ways We write application code based on the tests. This gives a test first environment for development and the generated application code turns out to be bug free. With each iteration we write tests and as a result with each iteration we get an automated regression pack. This turns out to be very helpful because with every iteration we can be sure that earlier features are working. These tests serve as documentation  of application behavior and reference for future iterations.
  • #5: BDD is popular and can be utilised for Unit level test cases and for UI level test cases. Tools like RSpec (for Ruby) or in .NET something like MSpec or SpecUnit is popular for Unit Testing following BDD approach.  Alternatively, you can write BDD-style specifications about UI interactions. Assuming you’re building a web application, you’ll probably use a browser automation library like WatiR/WatiN or Selenium, and script it either using one of the frameworks I just mentioned, or a given/when/then tool such as Cucumber (for Ruby) or SpecFlow (for .NET).
  • #6: BDD Tools Cucumber & SpecFlow What is Cucumber? Cucumber is a testing framework which supports Behavior Driven Development (BDD). It lets us define application behavior in plain meaningful English text using a simple grammar defined by a language called Gherkin. Cucumber itself is written in Ruby, but it can be used to “test” code written in Ruby or other languages including but not limited to Java, C# and Python.   What is SpecFlow? SpecFlow is inspired by Cucumber framework in the Ruby on Rails world. Cucumber uses plain English in the Gherkin format to express user stories. Once the user stories and their expectations are written, the Cucumber gem is used to execute those stores. SpecFlow brings the same concept to the .NET world and allows the developer to express the feature in plain English language. It also allows to write specification in human readable Gherkin format.
  • #7: Let’s assume there is a requirement from a client for an E-Commerce website to increase the sales of the product with implementing some new features on the website. The only challenge of the development team is to convert the client idea in to something that actually delivers the benefits to client. The original idea is awesome. But the only challenge here is that the person who is developing the idea is not the same person who has this idea. If the person who has the idea happens to be a talented software developer, then we might be in luck: the idea could be turned into working software without ever needing to be explained to anyone else. Now the idea needs to be communicated and has to travel from Business Owners(Client) to the development teams or many other people. Most software projects involve teams of several people working collaboratively together, so high-quality communication is critical to their success. As you probably know, good communication isn’t just about eloquently describing your ideas to others; you also need to solicit feedback to ensure you’ve been understood correctly. This is why agile software teams have learned to work in small increments, using the software that’s built incrementally as the feedback that says to the stakeholders “Is this what you mean?” Above image is the example of what clients have in their mind and communicated to the team of developers and how developers understands it and work on it. With the help of Gherkin language cucumber helps facilitate the discovery and use of a ubiquitous language within the team. Tests written in cucumber directly interact with the development code, but the tests are written in a language that is quite easy to understand by the business stakeholders. Cucumber test removes many misunderstandings long before they create any ambiguities in to the code.
  • #8: Now after a look on the above example code anybody can understand the working of the test and what it is intend to do. It gives an unexpected powerful impact by enabling people to visualize the system before it has been built. Any of the business user would read and understand the test and able to give you the feedback that whether it reflects their understanding of what the system should do, and it can even leads to thinking of other scenarios that needs to be consider too.
  • #9: Before diving in to Gherkin, it is necessary to understand the importance and need of a common language across different domains of project. By different domains I  By different domains I mean Clients, Developers, Testers, Business analysts and the Managerial team. Let’s start with talking about usual problems of a development project first and then we will move to a solution, while doing so we will come across the need for a common language. Assume you are a part of a technical team (Developer and Tester) and you have a task of collaborating with the business team (Business owners and Business analysts). You have to come up with the requirements of your project, these requirements will be what your development team will be implementing and test team will be testing. Also, that you have to make a small search feature on your E-Commerce platform. This feature will allow users to search for a product on your website. As we all might have faced in our experience that requirement given by business team are very crude and basic. For example, in this scenario we may get following requirements:   3.    Functional Requirements 3.1    Search Functionality 3.1.1     User should be able to search for a product 3.1.2    Only the products related to search string should be displayed.   Questions raised from the above requirements As we can see these requirements are good and useful but are not accurate. They describe a broad behavior of the system but do not specify concrete behavior of the system. Let me illustrate it by dissecting the first requirement, first requirement says that user should be able to search for a product but it fails to specify following – What is the maximum searchable length of search string? – What should be the search results if user searches for an invalid product? – What are the valid characters that can be used to search? *and similarly a few more detailed behavior of the application.   Usually in a project we end up asking above questions with the business team and we get replies, most of the replies reach the project documentation but the unfortunate ones are lost in emails and telephonic conversations. Also these replies are open to interpretation, for example: Question to Business Owner : What should be the search results if user searches for an invalid product? Reply from Business Owner : Invalid product searches should show following text on the search page: No product found   Answers of the Questions result in to more Doubts and Interpretation We get the answers of the questions asked from the Business team but it opens for interpretation or doubts in following ways: – Definition of invalid product is ambiguous and different team members will interpret it in different ways. One may consider that an invalid product is one which is not present in the inventory and other team member might consider an invalid product to be one which is a spelling mistake. – The answer by the business team says that “No product found” text should be displayed on the page. Does it says that a new search option should be present for the user? or may be related/similar search options should be displayed for the user? These are exact points where error is introduced in the system. Also, if we analyze the second doubt we would see that user Business team would love to have a new search option and related/similar searches option presented to the user. However, they were not able to think of this scenario when the question was asked. As a result what happened in the above example is Business team and the technical teams are communicating at two different levels, business team being vague and technical team trying to be precise. Ambiguity being introduced in the system, here by the definition of “invalid product”. Not enough insight being given to the Business team, so that they could have come up with new scenarios. Some details of project being lost in emails and telephonic conversations.   How to Improve the Requirement? Now let’s improve the first requirement given by the business team and try to make it more precise: “When a user searches, without spelling mistake, for a product name present in the inventory. All the products with similar name should be displayed“ “When a user searches, without spelling mistake, for a product name present in the inventory. Search results should be displayed with exact matches first and then similar matches“ Here we can see that how clear the requirements have become and with these clear requirements we are able to think more about the system. For eg. In the case of second requirement, after reading it we may think of other scenarios like: What should happen when there no exact and similar matches? Should the user be given an error message? Or the user is given a message stating when the product is expected to arrive in inventory.   What have we achieved here? We have forced the client to think in terms of details. With this improved thinking Business teams are coming with more refined requirements. This in turn with reduces the ambiguity in the project and will make developers and testers life easy by reducing the number of incorrect implementations. Also, you can see that each requirement now documents one exact behavior of the application. This means that it can be considered as a requirement document in itself.
  • #11: We have forced the client to think in terms of details. With this improved thinking Business teams are coming with more refined requirements. This in turn with reduces the ambiguity in the project and will make developers and testers life easy by reducing the number of incorrect implementations. Also, you can see that each requirement now documents one exact behavior of the application. This means that it can be considered as a requirement document in itself.
  • #12: To answer these problems Gherkin was created. Gherkin is a simple, lightweight and structured language which uses regular spoken language to describe requirements and scenarios. By regular spoken language we mean English, French and around 30 more languages.
  • #15: Understanding of BDD Understanding SpecFlow, Cucumber Why BDD http://toolsqa.com/cucumber/behavior-driven-development/ Understanding Gherkin http://toolsqa.com/cucumber/gherkin/ Understanding of Feature File http://toolsqa.com/specflow/feature-file/ Understanding of Step Definition http://toolsqa.com/specflow/step-definition-file