SlideShare une entreprise Scribd logo
1  sur  23
Behavior Driven Development
With Cucumber and Gherkin
By – Arati Joshi
Audience
• Product Owners
• Business Owners
• Subject Matter Experts
• Business Analysts
• Testers
• Developers
What is Cucumber?
• Cucumber is framework designed specifically to help
business stakeholders get involved in writing
acceptance tests.
• It allows acceptance tests to be automated and the
acceptance tests to be “executed” against the system.
• It helps “bridging the communication gap between
domain experts and developers”.
• Each test case in Cucumber is called a scenario, and
scenarios are grouped into features.
• Each scenario contains several steps.
• Under the hood, step definitions translate from the
business-facing language(Gherkin) into Java code
What is an Acceptance Test?
• Validates that the ‘right’ system is being built
• Business/user/customer point of view
• Written in non-technical format
• Helps document what the system should do
• When automated, become “living
documentation”
• Shared team understanding of what’s being built
• Helps define what “done” means
What is Gherkin?
The business-facing parts of a Cucumber test suite, stored
in feature files, must be written according to syntax
rules—known as Gherkin—so that Cucumber can read
them.
Gherkin is –
• Business readable domain specific language
• Represents tests in natural language, not code
• Line-oriented
• Keywords(e.g. Feature, Scenario)
• Localized in 40+ spoken languages (French, Bulgarian,
Japanese etc.)
What we are going to discuss about?
• Feature
• Scenario
• Given, When, Then, And, But keywords
• Tags
• Comments
• Data Tables
• Scenario Outline
• Background
• pyStrings
Feature
• Start with “Feature: “ keyword
• Followed by feature name/terse description
• Optional free text description
Feature: Activate CAD/BOM Alignment functionality
In order to view the side by side report from the Wizard
As a valid AVBOM2 application user
I want an ability to set CAD BOM Effective Points for the AVBOM2 program in
the AVBOM2 application
Feature
In order to <meet some goal>
As a <type of stakeholder>
I want <a feature>
Example :-
Feature: View side by side report
In order to view side by side report from Wizard
As a valid AVBOM2 application user
I want an ability to set CAD BOM Effective point for AVBOM2 program in
AVBOM2 application
Value
centric
Feature
As a <type of stakeholder>
I want <a feature>
So that <some goal can be met>
Example :-
Feature: View side by side report
As a valid AVBOM2 application user
I want an ability to set CAD BOM Effective point for AVBOM2 program in
AVBOM2 application
So that I can view side by side report from Wizard
Role/person
centric
Scenario
• Concrete examples of expected system behavior
• Describes a particular situation
• Should be independent and isolated
• Can represent:
– Happy paths
– Error paths
• Start with “Scenario: “ keyword
• Followed by title
• Keep your scenarios short, and don’t have too
many, i.e., less than ???
Scenario Steps
Given When Then
Set up initial state Perform action(s) Check end state
Given
Purpose - To put the system in a known state before the user (or external
system) starts interacting with the system (in the When steps).Givens are like
preconditions in use cases.
Good practice – Avoid talking about user interaction in givens.
Example -
@FormValidation
Scenario: Check if valid program is selected for CAD BOM effective point selection
Given user is on the 'Activate CAD BOM Alignment screen'
When program is not selected
And the 'Save' button is clicked
Then screen should show an error stating
"""
Please select program first for effective point selection.
"""
When
Purpose - To describe the key action that the user performs.
Example -
@FormValidation
Scenario: Check if valid program is selected for CAD BOM effective point selection
Given user is on the 'Activate CAD BOM Alignment screen'
When program is not selected
And the 'Save' button is clicked
Then screen should show an error stating
"""
Please select program first for effective point selection.
"""
Then
Purpose - To observe outcomes
Good Practice - The observation should be related to business value/benefit
in your feature description. The observations should inspect output of the
system(a report, user interface, message, command output) and not
something which has no business value and instead part of implementation.
Example -
@FormValidation
Scenario: Check if valid program is selected for CAD BOM effective point selection
Given user is on the 'Activate CAD BOM Alignment screen'
When program is not selected
And the 'Save' button is clicked
Then screen should show an error stating
"""
Please select program first for effective point selection.
"""
And, But
Purpose - If you have several 'Given', 'When' or 'Then' steps then 'And' or
'But' could be used to read scenario more frequently.
Example -
@FormValidation
Scenario: Check if valid program is selected for CAD BOM effective point selection
Given user is on the 'Activate CAD BOM Alignment screen'
When program is not selected
And the 'Save' button is clicked
Then screen should show an error stating
"""
Please select program first for effective point selection.
""“
@AccessCheck
Scenario: Role check for user to be able to set the CAD BOM effective point for a program
Given role of the user is BOM Admin
Then user has 'Edit' access to 'Activate CAD BOM Alignment Screen'
But for all other roles user having 'Read Only' access to 'Activate CAD BOM Alignment Screen'
Tags
• Mark features and scenarios with arbitrary tags
• Map to unit test framework “categories”
• Scenarios “inherit” feature tags
• Can have multiple tags
• Tags specified using @
• @ignore is a special case
@AccessCheck
Scenario: Role check for user to be able to set the CAD BOM effective point for a
program
Given role of the user is BOM Admin
Then user has 'Edit' access to 'Activate CAD BOM Alignment
Screen'
But for all other roles user having 'Read Only' access to
‘Activate CAD BOM Alignment Screen'
Tags
• Possible uses:
– Group features into feature supersets
– Mark certain tests as @important
– Differentiate between @slow and @fast executing
tests
– Mark tests @wip
– Mark tests to be executed @weekly @daily
@hourly
– Mark tests as @humanexecuted
Comments
• Keywords in Cucumber can be preceded with
comments
• Comments allows user to provide details
about the ‘Feature’ or ‘Scenario’
Multiline Arguments - Data Tables
@Scenario: User logging in into AVBOM2 application is a valid AVBOM2 user
Given user has one of the roles given below
|UserRole |
|D & R Engineer |
|BOM Admin |
|CAD Designer |
|External Supplier |
Then user is a valid internal or external Ford Motor company user
Multiline Arguments - pyStrings
• Multiline Strings (also known as pyStrings) are handy for specifying larger piece of
text.
• Text should be offset by delimiters consisting of three double quote marks(“””) on
lines by themselves.
Example -
@FormValidation
Scenario: Check if valid program is selected for CAD BOM effective point selection
Given user is on the 'Activate CAD BOM Alignment screen'
When program is not selected
And the 'Save' button is clicked
Then screen should show an error stating
"""
Please select program first for effective point selection.
“””
Scenario Outline
@AccessCheck
Scenario Outline: User authorization to view 'Activate CAD BOM Alignment' link
Given user is valid internal or external Ford Motor Company user
And user has logged in to <Application Type>
And user has <User Role> role
Then user is able to view 'Activate CAD BOM Alignment' link
Examples:
|Application Type |User Role |
|AVBOM2 dashboard|Any |
|AVBOM2 portal |BOM Admin |
Background
• Provides context(state setup) to the scenarios in a feature
• Execute before every scenario
• Don’t use Background to set up complicated state unless that state is
something the reader actually needs to know.
• Background section short. After all, you’re expecting the user to actually
remember this stuff when reading your scenarios.
Example:
Background: User logging in into AVBOM2 application is valid AVBOM2 user
Given user has one of the roles given below
|UserRole |
|D & R Engineer |
|BOM Admin |
|CAD Designer |
|External Supplier |
Then user is valid internal or external Ford Motor company user
Summary
We learned about Gherkin language syntax:-
• Feature
• Scenario
• Given, When, Then, And, But keywords
• Tags
• Comments
• Data Tables
• pyStrings
• Scenario Outline
• Background

Contenu connexe

Tendances

BDD in Action – principles, practices and real-world application
BDD in Action – principles, practices and real-world applicationBDD in Action – principles, practices and real-world application
BDD in Action – principles, practices and real-world applicationJohn Ferguson Smart Limited
 
Automation test framework with cucumber – BDD
Automation test framework with cucumber – BDDAutomation test framework with cucumber – BDD
Automation test framework with cucumber – BDD123abcda
 
Cucumber presentation
Cucumber presentationCucumber presentation
Cucumber presentationAkhila B
 
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 JavaSeb Rose
 
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
 
An introduction to Behavior-Driven Development (BDD)
An introduction to Behavior-Driven Development (BDD)An introduction to Behavior-Driven Development (BDD)
An introduction to Behavior-Driven Development (BDD)Suman Guha
 
Introducing BDD and TDD with Cucumber
Introducing BDD and TDD with CucumberIntroducing BDD and TDD with Cucumber
Introducing BDD and TDD with CucumberKnoldus Inc.
 
Selenium with Cucumber
Selenium  with Cucumber Selenium  with Cucumber
Selenium with Cucumber Knoldus Inc.
 
Behavior Driven Development Pros and Cons
Behavior Driven Development Pros and ConsBehavior Driven Development Pros and Cons
Behavior Driven Development Pros and ConsIosif Itkin
 
BDD presentation
BDD presentationBDD presentation
BDD presentationtemebele
 
Introduction to BDD
Introduction to BDDIntroduction to BDD
Introduction to BDDKnoldus Inc.
 
Behavior-Driven Development and Automation Testing Using Cucumber Framework W...
Behavior-Driven Development and Automation Testing Using Cucumber Framework W...Behavior-Driven Development and Automation Testing Using Cucumber Framework W...
Behavior-Driven Development and Automation Testing Using Cucumber Framework W...KMS Technology
 
BDD testing with cucumber
BDD testing with cucumberBDD testing with cucumber
BDD testing with cucumberDaniel Kummer
 

Tendances (20)

Cucumber ppt
Cucumber pptCucumber ppt
Cucumber ppt
 
BDD with Cucumber
BDD with CucumberBDD with Cucumber
BDD 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
 
BDD in Action – principles, practices and real-world application
BDD in Action – principles, practices and real-world applicationBDD in Action – principles, practices and real-world application
BDD in Action – principles, practices and real-world application
 
Automation test framework with cucumber – BDD
Automation test framework with cucumber – BDDAutomation test framework with cucumber – BDD
Automation test framework with cucumber – BDD
 
Cucumber presentation
Cucumber presentationCucumber presentation
Cucumber presentation
 
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
 
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)
 
Bdd Introduction
Bdd IntroductionBdd Introduction
Bdd Introduction
 
An introduction to Behavior-Driven Development (BDD)
An introduction to Behavior-Driven Development (BDD)An introduction to Behavior-Driven Development (BDD)
An introduction to Behavior-Driven Development (BDD)
 
Automated Test Framework with Cucumber
Automated Test Framework with CucumberAutomated Test Framework with Cucumber
Automated Test Framework with Cucumber
 
Introducing BDD and TDD with Cucumber
Introducing BDD and TDD with CucumberIntroducing BDD and TDD with Cucumber
Introducing BDD and TDD with Cucumber
 
Cucumber_Training_ForQA
Cucumber_Training_ForQACucumber_Training_ForQA
Cucumber_Training_ForQA
 
Selenium with Cucumber
Selenium  with Cucumber Selenium  with Cucumber
Selenium with Cucumber
 
Behavior Driven Development Pros and Cons
Behavior Driven Development Pros and ConsBehavior Driven Development Pros and Cons
Behavior Driven Development Pros and Cons
 
BDD presentation
BDD presentationBDD presentation
BDD presentation
 
Introduction to BDD
Introduction to BDDIntroduction to BDD
Introduction to BDD
 
Behavior-Driven Development and Automation Testing Using Cucumber Framework W...
Behavior-Driven Development and Automation Testing Using Cucumber Framework W...Behavior-Driven Development and Automation Testing Using Cucumber Framework W...
Behavior-Driven Development and Automation Testing Using Cucumber Framework W...
 
BDD testing with cucumber
BDD testing with cucumberBDD testing with cucumber
BDD testing with cucumber
 

En vedette

The Gherkin: Case Study
The Gherkin: Case StudyThe Gherkin: Case Study
The Gherkin: Case StudyVikram Bengani
 
Behavior driven development - cucumber, Junit and java
Behavior driven development - cucumber, Junit and javaBehavior driven development - cucumber, Junit and java
Behavior driven development - cucumber, Junit and javaNaveen Kumar Singh
 
CUCUMBER - Making BDD Fun
CUCUMBER - Making BDD FunCUCUMBER - Making BDD Fun
CUCUMBER - Making BDD FunSQABD
 
Why BDD is misunderstood
Why BDD is misunderstoodWhy BDD is misunderstood
Why BDD is misunderstoodThoughtworks
 
BDD, Gherkin, Cucumber and why we need it.
BDD, Gherkin, Cucumber and why we need it.BDD, Gherkin, Cucumber and why we need it.
BDD, Gherkin, Cucumber and why we need it.AlexOsadchyy
 
Tutorial: Implementing Specification-By-Example with Gherkin
Tutorial: Implementing Specification-By-Example with GherkinTutorial: Implementing Specification-By-Example with Gherkin
Tutorial: Implementing Specification-By-Example with GherkinChristian Hassa
 
Behavior Driven Development (BDD) and Agile Testing
Behavior Driven Development (BDD) and Agile TestingBehavior Driven Development (BDD) and Agile Testing
Behavior Driven Development (BDD) and Agile Testingdversaci
 
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 CucumberKMS Technology
 
Behavior Driven Development with SpecFlow
Behavior Driven Development with SpecFlowBehavior Driven Development with SpecFlow
Behavior Driven Development with SpecFlowRachid Kherrazi
 
My Thesis Defense Presentation
My Thesis Defense PresentationMy Thesis Defense Presentation
My Thesis Defense PresentationDavid Onoue
 
Powerpoint presentation M.A. Thesis Defence
Powerpoint presentation M.A. Thesis DefencePowerpoint presentation M.A. Thesis Defence
Powerpoint presentation M.A. Thesis DefenceCatie Chase
 
Dissertation oral defense presentation
Dissertation   oral defense presentationDissertation   oral defense presentation
Dissertation oral defense presentationDr. Naomi Mangatu
 
How to Defend your Thesis Proposal like a Professional
How to Defend your Thesis Proposal like a ProfessionalHow to Defend your Thesis Proposal like a Professional
How to Defend your Thesis Proposal like a ProfessionalMiriam College
 
Powerpoint Presentation of PhD Viva
Powerpoint Presentation of PhD VivaPowerpoint Presentation of PhD Viva
Powerpoint Presentation of PhD VivaDr Mohan Savade
 
Thesis Powerpoint
Thesis PowerpointThesis Powerpoint
Thesis Powerpointneha47
 
Prepare your Ph.D. Defense Presentation
Prepare your Ph.D. Defense PresentationPrepare your Ph.D. Defense Presentation
Prepare your Ph.D. Defense PresentationChristian Glahn
 
Thesis Power Point Presentation
Thesis Power Point PresentationThesis Power Point Presentation
Thesis Power Point Presentationriddhikapandya1985
 

En vedette (20)

The Gherkin: Case Study
The Gherkin: Case StudyThe Gherkin: Case Study
The Gherkin: Case Study
 
Behavior driven development - cucumber, Junit and java
Behavior driven development - cucumber, Junit and javaBehavior driven development - cucumber, Junit and java
Behavior driven development - cucumber, Junit and java
 
CUCUMBER - Making BDD Fun
CUCUMBER - Making BDD FunCUCUMBER - Making BDD Fun
CUCUMBER - Making BDD Fun
 
Why BDD is misunderstood
Why BDD is misunderstoodWhy BDD is misunderstood
Why BDD is misunderstood
 
BDD, Gherkin, Cucumber and why we need it.
BDD, Gherkin, Cucumber and why we need it.BDD, Gherkin, Cucumber and why we need it.
BDD, Gherkin, Cucumber and why we need it.
 
BDD & Cucumber
BDD & CucumberBDD & Cucumber
BDD & Cucumber
 
Cucumber
CucumberCucumber
Cucumber
 
Tutorial: Implementing Specification-By-Example with Gherkin
Tutorial: Implementing Specification-By-Example with GherkinTutorial: Implementing Specification-By-Example with Gherkin
Tutorial: Implementing Specification-By-Example with Gherkin
 
Behavior Driven Development (BDD) and Agile Testing
Behavior Driven Development (BDD) and Agile TestingBehavior Driven Development (BDD) and Agile Testing
Behavior Driven Development (BDD) and Agile Testing
 
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
 
Behavior Driven Development with SpecFlow
Behavior Driven Development with SpecFlowBehavior Driven Development with SpecFlow
Behavior Driven Development with SpecFlow
 
Thesis powerpoint
Thesis powerpointThesis powerpoint
Thesis powerpoint
 
My Thesis Defense Presentation
My Thesis Defense PresentationMy Thesis Defense Presentation
My Thesis Defense Presentation
 
Powerpoint presentation M.A. Thesis Defence
Powerpoint presentation M.A. Thesis DefencePowerpoint presentation M.A. Thesis Defence
Powerpoint presentation M.A. Thesis Defence
 
Dissertation oral defense presentation
Dissertation   oral defense presentationDissertation   oral defense presentation
Dissertation oral defense presentation
 
How to Defend your Thesis Proposal like a Professional
How to Defend your Thesis Proposal like a ProfessionalHow to Defend your Thesis Proposal like a Professional
How to Defend your Thesis Proposal like a Professional
 
Powerpoint Presentation of PhD Viva
Powerpoint Presentation of PhD VivaPowerpoint Presentation of PhD Viva
Powerpoint Presentation of PhD Viva
 
Thesis Powerpoint
Thesis PowerpointThesis Powerpoint
Thesis Powerpoint
 
Prepare your Ph.D. Defense Presentation
Prepare your Ph.D. Defense PresentationPrepare your Ph.D. Defense Presentation
Prepare your Ph.D. Defense Presentation
 
Thesis Power Point Presentation
Thesis Power Point PresentationThesis Power Point Presentation
Thesis Power Point Presentation
 

Similaire à Bdd – with cucumber and gherkin

Browser-Based Load Testing with Grafana K6
Browser-Based Load Testing with Grafana K6Browser-Based Load Testing with Grafana K6
Browser-Based Load Testing with Grafana K6Knoldus Inc.
 
26 story slicing techniques for any scrum team
26 story slicing techniques for any scrum team26 story slicing techniques for any scrum team
26 story slicing techniques for any scrum teamagilebin
 
Build the Right Regression Suite with Behavior-Driven Testing
Build the Right Regression Suite with Behavior-Driven TestingBuild the Right Regression Suite with Behavior-Driven Testing
Build the Right Regression Suite with Behavior-Driven TestingTechWell
 
Spectacular Specs and how to write them!
Spectacular Specs and how to write them!Spectacular Specs and how to write them!
Spectacular Specs and how to write them!YeurDreamin'
 
IBM Cognos 10 Framework Manager Metadata Modeling: Tips and Tricks
IBM Cognos 10 Framework Manager Metadata Modeling: Tips and TricksIBM Cognos 10 Framework Manager Metadata Modeling: Tips and Tricks
IBM Cognos 10 Framework Manager Metadata Modeling: Tips and TricksSenturus
 
CCI 2019 - PowerApps for Enterprise Developers
CCI 2019 - PowerApps for Enterprise DevelopersCCI 2019 - PowerApps for Enterprise Developers
CCI 2019 - PowerApps for Enterprise Developerswalk2talk srl
 
Software Testing includes Performance testing with Load Runner and the JMeter
Software Testing includes Performance testing with Load Runner and the JMeter Software Testing includes Performance testing with Load Runner and the JMeter
Software Testing includes Performance testing with Load Runner and the JMeter Hima Bindu Kosuru
 
PERFORMANCE TESTING USING LOAD RUNNER
PERFORMANCE  TESTING  USING  LOAD RUNNERPERFORMANCE  TESTING  USING  LOAD RUNNER
PERFORMANCE TESTING USING LOAD RUNNERAjithaG9
 
Test Automation Frameworks Final
Test Automation Frameworks   FinalTest Automation Frameworks   Final
Test Automation Frameworks FinalMargaret_Dickman
 
Why You Need to Care About Automated Functional Testing in 2019
Why You Need to Care About Automated Functional Testing in 2019Why You Need to Care About Automated Functional Testing in 2019
Why You Need to Care About Automated Functional Testing in 2019Sarah Elson
 
BDD Selenium for Agile Teams - User Stories
BDD Selenium for Agile Teams - User StoriesBDD Selenium for Agile Teams - User Stories
BDD Selenium for Agile Teams - User StoriesSauce Labs
 

Similaire à Bdd – with cucumber and gherkin (20)

User Stories Lunch & Learn
User Stories Lunch & LearnUser Stories Lunch & Learn
User Stories Lunch & Learn
 
Browser-Based Load Testing with Grafana K6
Browser-Based Load Testing with Grafana K6Browser-Based Load Testing with Grafana K6
Browser-Based Load Testing with Grafana K6
 
About QTP 9.2
About QTP 9.2About QTP 9.2
About QTP 9.2
 
About Qtp_1 92
About Qtp_1 92About Qtp_1 92
About Qtp_1 92
 
About Qtp 92
About Qtp 92About Qtp 92
About Qtp 92
 
Priyanka_Resume
Priyanka_ResumePriyanka_Resume
Priyanka_Resume
 
26 story slicing techniques for any scrum team
26 story slicing techniques for any scrum team26 story slicing techniques for any scrum team
26 story slicing techniques for any scrum team
 
Build the Right Regression Suite with Behavior-Driven Testing
Build the Right Regression Suite with Behavior-Driven TestingBuild the Right Regression Suite with Behavior-Driven Testing
Build the Right Regression Suite with Behavior-Driven Testing
 
Spectacular Specs and how to write them!
Spectacular Specs and how to write them!Spectacular Specs and how to write them!
Spectacular Specs and how to write them!
 
Qtp check points
Qtp check pointsQtp check points
Qtp check points
 
Camunda BPM 7.2 - English
Camunda BPM 7.2 - EnglishCamunda BPM 7.2 - English
Camunda BPM 7.2 - English
 
IBM Cognos 10 Framework Manager Metadata Modeling: Tips and Tricks
IBM Cognos 10 Framework Manager Metadata Modeling: Tips and TricksIBM Cognos 10 Framework Manager Metadata Modeling: Tips and Tricks
IBM Cognos 10 Framework Manager Metadata Modeling: Tips and Tricks
 
CCI 2019 - PowerApps for Enterprise Developers
CCI 2019 - PowerApps for Enterprise DevelopersCCI 2019 - PowerApps for Enterprise Developers
CCI 2019 - PowerApps for Enterprise Developers
 
Software Testing includes Performance testing with Load Runner and the JMeter
Software Testing includes Performance testing with Load Runner and the JMeter Software Testing includes Performance testing with Load Runner and the JMeter
Software Testing includes Performance testing with Load Runner and the JMeter
 
PERFORMANCE TESTING USING LOAD RUNNER
PERFORMANCE  TESTING  USING  LOAD RUNNERPERFORMANCE  TESTING  USING  LOAD RUNNER
PERFORMANCE TESTING USING LOAD RUNNER
 
ravi kumar s
ravi kumar sravi kumar s
ravi kumar s
 
Onlineshopping
OnlineshoppingOnlineshopping
Onlineshopping
 
Test Automation Frameworks Final
Test Automation Frameworks   FinalTest Automation Frameworks   Final
Test Automation Frameworks Final
 
Why You Need to Care About Automated Functional Testing in 2019
Why You Need to Care About Automated Functional Testing in 2019Why You Need to Care About Automated Functional Testing in 2019
Why You Need to Care About Automated Functional Testing in 2019
 
BDD Selenium for Agile Teams - User Stories
BDD Selenium for Agile Teams - User StoriesBDD Selenium for Agile Teams - User Stories
BDD Selenium for Agile Teams - User Stories
 

Dernier

HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfCionsystems
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 

Dernier (20)

HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdf
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 

Bdd – with cucumber and gherkin

  • 1. Behavior Driven Development With Cucumber and Gherkin By – Arati Joshi
  • 2. Audience • Product Owners • Business Owners • Subject Matter Experts • Business Analysts • Testers • Developers
  • 3. What is Cucumber? • Cucumber is framework designed specifically to help business stakeholders get involved in writing acceptance tests. • It allows acceptance tests to be automated and the acceptance tests to be “executed” against the system. • It helps “bridging the communication gap between domain experts and developers”. • Each test case in Cucumber is called a scenario, and scenarios are grouped into features. • Each scenario contains several steps. • Under the hood, step definitions translate from the business-facing language(Gherkin) into Java code
  • 4. What is an Acceptance Test? • Validates that the ‘right’ system is being built • Business/user/customer point of view • Written in non-technical format • Helps document what the system should do • When automated, become “living documentation” • Shared team understanding of what’s being built • Helps define what “done” means
  • 5. What is Gherkin? The business-facing parts of a Cucumber test suite, stored in feature files, must be written according to syntax rules—known as Gherkin—so that Cucumber can read them. Gherkin is – • Business readable domain specific language • Represents tests in natural language, not code • Line-oriented • Keywords(e.g. Feature, Scenario) • Localized in 40+ spoken languages (French, Bulgarian, Japanese etc.)
  • 6. What we are going to discuss about? • Feature • Scenario • Given, When, Then, And, But keywords • Tags • Comments • Data Tables • Scenario Outline • Background • pyStrings
  • 7. Feature • Start with “Feature: “ keyword • Followed by feature name/terse description • Optional free text description Feature: Activate CAD/BOM Alignment functionality In order to view the side by side report from the Wizard As a valid AVBOM2 application user I want an ability to set CAD BOM Effective Points for the AVBOM2 program in the AVBOM2 application
  • 8. Feature In order to <meet some goal> As a <type of stakeholder> I want <a feature> Example :- Feature: View side by side report In order to view side by side report from Wizard As a valid AVBOM2 application user I want an ability to set CAD BOM Effective point for AVBOM2 program in AVBOM2 application Value centric
  • 9. Feature As a <type of stakeholder> I want <a feature> So that <some goal can be met> Example :- Feature: View side by side report As a valid AVBOM2 application user I want an ability to set CAD BOM Effective point for AVBOM2 program in AVBOM2 application So that I can view side by side report from Wizard Role/person centric
  • 10. Scenario • Concrete examples of expected system behavior • Describes a particular situation • Should be independent and isolated • Can represent: – Happy paths – Error paths • Start with “Scenario: “ keyword • Followed by title • Keep your scenarios short, and don’t have too many, i.e., less than ???
  • 11. Scenario Steps Given When Then Set up initial state Perform action(s) Check end state
  • 12. Given Purpose - To put the system in a known state before the user (or external system) starts interacting with the system (in the When steps).Givens are like preconditions in use cases. Good practice – Avoid talking about user interaction in givens. Example - @FormValidation Scenario: Check if valid program is selected for CAD BOM effective point selection Given user is on the 'Activate CAD BOM Alignment screen' When program is not selected And the 'Save' button is clicked Then screen should show an error stating """ Please select program first for effective point selection. """
  • 13. When Purpose - To describe the key action that the user performs. Example - @FormValidation Scenario: Check if valid program is selected for CAD BOM effective point selection Given user is on the 'Activate CAD BOM Alignment screen' When program is not selected And the 'Save' button is clicked Then screen should show an error stating """ Please select program first for effective point selection. """
  • 14. Then Purpose - To observe outcomes Good Practice - The observation should be related to business value/benefit in your feature description. The observations should inspect output of the system(a report, user interface, message, command output) and not something which has no business value and instead part of implementation. Example - @FormValidation Scenario: Check if valid program is selected for CAD BOM effective point selection Given user is on the 'Activate CAD BOM Alignment screen' When program is not selected And the 'Save' button is clicked Then screen should show an error stating """ Please select program first for effective point selection. """
  • 15. And, But Purpose - If you have several 'Given', 'When' or 'Then' steps then 'And' or 'But' could be used to read scenario more frequently. Example - @FormValidation Scenario: Check if valid program is selected for CAD BOM effective point selection Given user is on the 'Activate CAD BOM Alignment screen' When program is not selected And the 'Save' button is clicked Then screen should show an error stating """ Please select program first for effective point selection. ""“ @AccessCheck Scenario: Role check for user to be able to set the CAD BOM effective point for a program Given role of the user is BOM Admin Then user has 'Edit' access to 'Activate CAD BOM Alignment Screen' But for all other roles user having 'Read Only' access to 'Activate CAD BOM Alignment Screen'
  • 16. Tags • Mark features and scenarios with arbitrary tags • Map to unit test framework “categories” • Scenarios “inherit” feature tags • Can have multiple tags • Tags specified using @ • @ignore is a special case @AccessCheck Scenario: Role check for user to be able to set the CAD BOM effective point for a program Given role of the user is BOM Admin Then user has 'Edit' access to 'Activate CAD BOM Alignment Screen' But for all other roles user having 'Read Only' access to ‘Activate CAD BOM Alignment Screen'
  • 17. Tags • Possible uses: – Group features into feature supersets – Mark certain tests as @important – Differentiate between @slow and @fast executing tests – Mark tests @wip – Mark tests to be executed @weekly @daily @hourly – Mark tests as @humanexecuted
  • 18. Comments • Keywords in Cucumber can be preceded with comments • Comments allows user to provide details about the ‘Feature’ or ‘Scenario’
  • 19. Multiline Arguments - Data Tables @Scenario: User logging in into AVBOM2 application is a valid AVBOM2 user Given user has one of the roles given below |UserRole | |D & R Engineer | |BOM Admin | |CAD Designer | |External Supplier | Then user is a valid internal or external Ford Motor company user
  • 20. Multiline Arguments - pyStrings • Multiline Strings (also known as pyStrings) are handy for specifying larger piece of text. • Text should be offset by delimiters consisting of three double quote marks(“””) on lines by themselves. Example - @FormValidation Scenario: Check if valid program is selected for CAD BOM effective point selection Given user is on the 'Activate CAD BOM Alignment screen' When program is not selected And the 'Save' button is clicked Then screen should show an error stating """ Please select program first for effective point selection. “””
  • 21. Scenario Outline @AccessCheck Scenario Outline: User authorization to view 'Activate CAD BOM Alignment' link Given user is valid internal or external Ford Motor Company user And user has logged in to <Application Type> And user has <User Role> role Then user is able to view 'Activate CAD BOM Alignment' link Examples: |Application Type |User Role | |AVBOM2 dashboard|Any | |AVBOM2 portal |BOM Admin |
  • 22. Background • Provides context(state setup) to the scenarios in a feature • Execute before every scenario • Don’t use Background to set up complicated state unless that state is something the reader actually needs to know. • Background section short. After all, you’re expecting the user to actually remember this stuff when reading your scenarios. Example: Background: User logging in into AVBOM2 application is valid AVBOM2 user Given user has one of the roles given below |UserRole | |D & R Engineer | |BOM Admin | |CAD Designer | |External Supplier | Then user is valid internal or external Ford Motor company user
  • 23. Summary We learned about Gherkin language syntax:- • Feature • Scenario • Given, When, Then, And, But keywords • Tags • Comments • Data Tables • pyStrings • Scenario Outline • Background

Notes de l'éditeur

  1. Behavior driven development and ‘How to use Cucumber’ has already been discussed in presentation given by Curt Reinke. This slide presents summary recap about that topic.
  2. Acceptance test validates if ‘right’ system is being built, meaning the requirements captured from user and their viewpoint is correctly being implemented and translated into code. Junit makes sure the code being built is ‘right’ code. This approach keeps project teams keep business aspect in mind first. Slide above talks about few characteristics of good ‘Acceptance Test’.
  3. This slide talks about what is ‘Gherkin’ and some of the features of Gherkin language.
  4. This slide talks about different entities of Gherkin feature file and keywords used while writing a feature file.
  5. Template above is called feature injection template.
  6. In the example above, Given step is user has already logged in successfully and is on the screen 'Activate CAD BOM Alignment'. This would be a precondition for checking if the contents of the form are valid.
  7. In the example above, When step is program is not selected. It is specific action that user is not supposed to perform in this example.
  8. In the example above, 'And' step is used as continuation of 'When' step in order to provide more readability and condition for user's next action(e.g. -'Save' button is clicked)
  9. When richer data structures need to be passed from Step to a step definition, multiline arguments can be used. Data tables are used to prevent multiple scenarios with slight changes.
  10. You can have a single ‘Background’ element per feature file and it must appear before any of the Scenario or Scenario Outline statements. You can give it a name, and you have space to put a multiline description before the first step.