SlideShare uma empresa Scribd logo
1 de 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

Mais conteúdo relacionado

Mais procurados

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
 

Mais procurados (20)

Introduction to Bdd and cucumber
Introduction to Bdd and cucumberIntroduction to Bdd and cucumber
Introduction to Bdd and cucumber
 
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
 
BDD & Cucumber
BDD & CucumberBDD & Cucumber
BDD & Cucumber
 
Bdd Introduction
Bdd IntroductionBdd Introduction
Bdd Introduction
 
Cucumber presentation
Cucumber presentationCucumber presentation
Cucumber presentation
 
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)
 
Cucumber presenation
Cucumber presenationCucumber presenation
Cucumber presenation
 
Gherkin /BDD intro
Gherkin /BDD introGherkin /BDD intro
Gherkin /BDD intro
 
Automated Test Framework with Cucumber
Automated Test Framework with CucumberAutomated Test Framework with Cucumber
Automated Test Framework with Cucumber
 
Cucumber ppt
Cucumber pptCucumber ppt
Cucumber ppt
 
BDD testing with cucumber
BDD testing with cucumberBDD testing with cucumber
BDD testing with cucumber
 
Selenium with Cucumber
Selenium  with Cucumber Selenium  with Cucumber
Selenium with Cucumber
 
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)
 
Test automation with Cucumber-JVM
Test automation with Cucumber-JVMTest automation with Cucumber-JVM
Test automation with Cucumber-JVM
 
Behavior driven development (bdd)
Behavior driven development (bdd)Behavior driven development (bdd)
Behavior driven development (bdd)
 
Introduction to BDD
Introduction to BDDIntroduction to BDD
Introduction to BDD
 
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
 
BDD presentation
BDD presentationBDD presentation
BDD presentation
 
Successfully Implementing BDD in an Agile World
Successfully Implementing BDD in an Agile WorldSuccessfully Implementing BDD in an Agile World
Successfully Implementing BDD in an Agile World
 
Bdd and spec flow
Bdd and spec flowBdd and spec flow
Bdd and spec flow
 

Destaque

Why BDD is misunderstood
Why BDD is misunderstoodWhy BDD is misunderstood
Why BDD is misunderstood
Thoughtworks
 
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
dversaci
 
Powerpoint presentation M.A. Thesis Defence
Powerpoint presentation M.A. Thesis DefencePowerpoint presentation M.A. Thesis Defence
Powerpoint presentation M.A. Thesis Defence
Catie Chase
 
Dissertation oral defense presentation
Dissertation   oral defense presentationDissertation   oral defense presentation
Dissertation oral defense presentation
Dr. Naomi Mangatu
 
Thesis Powerpoint
Thesis PowerpointThesis Powerpoint
Thesis Powerpoint
neha47
 
Prepare your Ph.D. Defense Presentation
Prepare your Ph.D. Defense PresentationPrepare your Ph.D. Defense Presentation
Prepare your Ph.D. Defense Presentation
Christian Glahn
 
Thesis Power Point Presentation
Thesis Power Point PresentationThesis Power Point Presentation
Thesis Power Point Presentation
riddhikapandya1985
 

Destaque (19)

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 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
 

Semelhante a Bdd – with cucumber and gherkin

Semelhante a 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 92
About Qtp 92About Qtp 92
About Qtp 92
 
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
 
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!
 
Cucumber_Training_ForQA
Cucumber_Training_ForQACucumber_Training_ForQA
Cucumber_Training_ForQA
 
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
 

Último

Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Medical / Health Care (+971588192166) Mifepristone and Misoprostol tablets 200mg
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
masabamasaba
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
masabamasaba
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
VictoriaMetrics
 

Último (20)

AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 
What Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationWhat Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the Situation
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
 
tonesoftg
tonesoftgtonesoftg
tonesoftg
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
 

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

Notas do Editor

  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.