SlideShare a Scribd company logo
1 of 33
1
BDD Frameworks Overview
Shapin Anton
August 19, 2016
2
• Lead Software Test Automation Engineer
• 9+ years in IT
• Areas of my competency: manual,
automation, performance and etc.
• Successfully completed more than 9 BDD
projects.
Email: anton_shapin@epam.com
Skype: anton_shapin
Shapin Anton
3
Agenda
BDD approach1
Pros, cons, restrictions of BDD2
Coding tricks in Cucumber-
JVM
3
4
LET`S START !
5
Main questions:
What is BDD ?1
Why do we need BDD ?2
What are the “bonuses” and
minuses of BDD approach?
3
Where to begin?4
6
What customers see in BDD:
We can understand what our
automated tests are doing.
1
Executable specification.2
Reducing cost of test
automation.
3
A better product.4
We can write clear tests in their
native language.
5
7
What qa engineers see in BDD:
Automated tests in native language.
What is it?
1
Should we rewrite all of our tests?2
How we will maintain tests?3
Our tests will be unstable!4
It will be additional work (test-cases should
be migrated to language of scenarios).
5
8
BDD approach
BDD(behavior-driven development) - is a set of software engineering practices
designed to help teams build and deliver more valuable, higher quality software faster. It
draws on Agile and lean practices including, in particular, Test-Driven Development (TDD) and
Domain-Driven Design (DDD).
BDD isn’t a software development methodology in its own right. It’s not a replacement
for Scrum, XP, Kanban, RUP, or whatever methodology you’re currently using.
MAIN GOAL: EXECUTABLE SPECIFICATION
9
BDD process
10
BDD
Given describes the preconditions for
the scenario and prepares the test
environment.
When describes the action under
test.
2
Then describes the expected
outcomes.
3
The And and But keywords can be used
to join several Given, When, or Then
steps together in a more readable way.
4
1
Example of GUI Scenario
Scenario: Running a Full Text Quick Search.
Given I perform Quick Search by "IPhone 4S"
When I click on link 'Search History' on panel 'Quick Search'
Then the term query "IPhone 4S" should be the first in the Search
History grid
12
BDD vs “Classical” style of test
AUTOMATED TEST IN GERKHIN FORMAT(TEST IN BDD STYLE) AUTOMATED TEST IN “CLASSICAL” STYLE
Scenario: Running a Full Text Quick Search.
Given I perform Quick Search by "IPhone 4S"
When I click on link 'Search History' on panel 'Quick Search'
Then the term query "IPhone 4S" should be the first in the Search History
grid
@Test
public void checkFullTextSearch() {
homepage.open();
quickSearchForm.setSearchQuery(“IPhone 4S”);
quickSearchForm.perform();
quickSearchForm.openSearchHistory();
searchHistory.isQueryTheFirst(“IPhone 4S”);
}
13
How it works
@Given("^I perform Quick Search by "([^"]*)" $")
public void i_perform_quick_search_by(String query) {
driver.findElement(By.id(“searchQuery”)).sendKeys(query);
driver.findElement(By.id(“submit”)).click();
}
Scenario: Running a Full Text Quick Search.
Given I perform Quick Search by "IPhone 4S"
...
Each step maps to Java Method
14
The main layers of a Cucumber test suite
15
BDD restrictions :
BDD works very well only if the team of
analysts, developers, testers are near, but not
in different locations.
1
Work is performed on an isolated part of
the product by a small team.
2
The system does not have tests with a
complex structure of the test data.
3
16
Pros:
The acceptance criteria are nice thought.1
We get executable specification.2
All test cases and automated tests are up to date.3
Application development time reduced.4
Test logic is in total independent layer of
implementation.
5
Manual qa engineer can use automated test scenarios
for manual testing.
6
17
Cons:
It is not possible to do testing in the middle of the
test. Checks are made only in the THEN section.
1
It's hard to maintain reusable steps in the
scenarios. Very often it leads to duplication of
code in the test system.
2
It is difficult to refactor tests.3
It is necessary to create and maintain the
Domain Dictionary for writing tests.
4
The complexity of writing test scenarios without
Helper-s (typos, say the phrase can be
different).
5
18
Where to begin
1. Think, whether you need to BDD and formulate specific
goals you want to achieve.
2. Read the book "BDD in Actions".
5. Very carefully think through the architecture of your test
system (What? Where? Why? How?).
4. Create the initial version of the Domain vocabulary and
rules for test scenarios writing.
3. Select the BDD framework. Examine the documentation
carefully.
!!! FORWARD !!!
19
Languages, Frameworks
FRAMEWORKSLANGUAGES
RSpec
JDaveCola
20
Functional tests
BACK-END TESTS
(SERVICES, API and etc)
UI TESTS
(WEB APPLICATION)
TYPES OF TESTS
The scenarios should
express what a user
should be able to do, and
NOT HOW.
Very important is what a
user should be able to
do, and HOW
21
Step structure
WHEN The user clicks the button “SAVE" in the Report Navigation Column on the Search Results page
WHEN
WHO
NAME OF
ACTION
OBJECT OF
ACTION
AREA OF
ACTION
PAGE NAME
LINK+<TITLE>
BUTTON+<TITLE>
TEXTBOX+<TITLE>
…
TABLE
PANEL
POP-UP
MODAL FORM
TAB
…
PAGE NAME
CLICK
SELECT
…
I
THE USER
22
Step structure
THEN the term "<query>" should be the first in the Search History grid on the My History page
THEN
WHAT
SHOULD
[NOT] BE
AREA OF
ACTION
PAGE NAME
TABLE
PANEL
POP-UP
MODAL FORM
TAB
…
PAGE NAME
SHOULD BE
SHOULD NOT BE
The term
…
23
Step structure
WHEN The user performs the Full Search with parameters: query: “fish"; city: “Murmansk"; on the Home page
COMPLEX
WHO
NAME OF
ACTION
OBJECT OF
ACTION
WITH
PARAMETERS:
PAGE NAME
LINK+<TITLE>
BUTTON+<TITLE>
TEXTBOX+<TITLE>
…
PARAM:VALUE PAGE NAME
PERFORM
FILL
…
I
THE USER
Small tricks when working with Cucumber-JVM
Scenario Outline: Running a Full Text Quick Search.
Given I perform Quick Search by “<query>"
When I click on link 'Search History' on panel 'Quick Search'
Then the term query “<query>" should be the first in the Search History grid
Examples:
|query |
| IPhone 4S |
| BMW X5 |
25
Small tricks when working with Cucumber-JVM
Given the user navigate to the Home page
=
Given the user open the Home page
(?: navigate to|open) не равно (:? navigate to|open)
/**
* Open "Home page"
*/
@Given("^the user (?:navigate to|open) the Home page$")
public void the_user_open_the_Home_page() {
homePage.open();
}
26
Small tricks when working with Cucumber-JVM
When the user navigates to “Simple” report type on the page ‘Results’
=
When the user navigates to report type “Simple” on the page ‘Results’
@When("^I navigate to (?:"([^"]*)" report type|report type "([^"]*)" ) on page 'Results'$")
public void I_navigate_to_report (String dataset, String dataset2){
if(dataset!=null) {
// TODO: code goes here
}else{
// TODO: code goes here
}
}
27
Small tricks when working with Cucumber-JVM
Given I have 5 cucumbers in my basket
=
Given I have 1 cucumber in my basket
@Given("^I have (d+) cucumbers? in my basket$")
public void i_have_cucumber(int number) {
// TODO: code goes here
}
28
Small tricks when working with Cucumber-JVM
Then the response should be JSON:
"""
[{"name":"BMW X5", "color": "Blue"},
{"name":"UAZ Patriot", "color": "Blue"}]
"""
@Then("^the response should be JSON:$")
public void theResponseShouldBeJSON(String expectedJson){
// TODO: code goes here
}
IDE Helper (plugin for IDEA) to write steps of
scenario
• We can see all implemented
steps when printing text of
step
• We can see full description
of steps
• Helper reduces time of step
creation
KEY POINTS
Best Practices. Test Step Creation.
User Helpers. For example IntelliJ IDEA plugin «Cucumber for Java»
31
Conclusion
1. BDD is a very good approach. But this is not a magic bullet.
2. Improper using will bring more problems than benefits.
5. Tests Stability and BDD usability depends on you.
4. Do not confuse the BDD and tests written in
Gherkin.
3. To use or not to use BDD depends on situation and project.
32
Useful materials
1. Video: Useful practices of creation automatic tests by using Cucumber-JVM:
https://goo.gl/ZftM9h
2. Video: From Manual to Automated Testing:
https://videoportal.epam.com/video/noPgmXaX
5. Book: “Specification by Example”
4. Book: “Cucumber Recipes”
3. Book: “BDD in Actions”
6. Allure-cucumber-plugin: https://github.com/kirlionik/allure-
cucumber-plugin
33
Thank you for attention!
Email: anton_shapin@epam.com
Skype: anton_shapin

More Related Content

What's hot

Component lifecycle hooks in Angular 2.0
Component lifecycle hooks in Angular 2.0Component lifecycle hooks in Angular 2.0
Component lifecycle hooks in Angular 2.0Eyal Vardi
 
Functional Programming in JavaScript by Luis Atencio
Functional Programming in JavaScript by Luis AtencioFunctional Programming in JavaScript by Luis Atencio
Functional Programming in JavaScript by Luis AtencioLuis Atencio
 
Database Anti Patterns
Database Anti PatternsDatabase Anti Patterns
Database Anti PatternsRobert Treat
 
MySQL Indexing - Best practices for MySQL 5.6
MySQL Indexing - Best practices for MySQL 5.6MySQL Indexing - Best practices for MySQL 5.6
MySQL Indexing - Best practices for MySQL 5.6MYXPLAIN
 
The MySQL Query Optimizer Explained Through Optimizer Trace
The MySQL Query Optimizer Explained Through Optimizer TraceThe MySQL Query Optimizer Explained Through Optimizer Trace
The MySQL Query Optimizer Explained Through Optimizer Traceoysteing
 
Fundamental JavaScript [UTC, March 2014]
Fundamental JavaScript [UTC, March 2014]Fundamental JavaScript [UTC, March 2014]
Fundamental JavaScript [UTC, March 2014]Aaron Gustafson
 
database application using SQL DML statements: all types of Join, Sub-Query ...
 database application using SQL DML statements: all types of Join, Sub-Query ... database application using SQL DML statements: all types of Join, Sub-Query ...
database application using SQL DML statements: all types of Join, Sub-Query ...bhavesh lande
 
Routing & Navigating Pages in Angular 2
Routing & Navigating Pages in Angular 2Routing & Navigating Pages in Angular 2
Routing & Navigating Pages in Angular 2Knoldus Inc.
 
Library Management System in c++
Library Management System in c++Library Management System in c++
Library Management System in c++vikram mahendra
 
Introduction to Web Development Career
Introduction to Web Development CareerIntroduction to Web Development Career
Introduction to Web Development CareerEunus Hosen
 
Golang @ Tokopedia
Golang @ TokopediaGolang @ Tokopedia
Golang @ TokopediaQasim Zaidi
 
An introduction to Google test framework
An introduction to Google test frameworkAn introduction to Google test framework
An introduction to Google test frameworkAbner Chih Yi Huang
 
More mastering the art of indexing
More mastering the art of indexingMore mastering the art of indexing
More mastering the art of indexingYoshinori Matsunobu
 
为啥别读HotSpot VM的源码(2012-03-03)
为啥别读HotSpot VM的源码(2012-03-03)为啥别读HotSpot VM的源码(2012-03-03)
为啥别读HotSpot VM的源码(2012-03-03)Kris Mok
 
Cracking the Algorithm & Coding Interview
Cracking the Algorithm & Coding InterviewCracking the Algorithm & Coding Interview
Cracking the Algorithm & Coding InterviewGayle McDowell
 
Introduction to Python Pandas for Data Analytics
Introduction to Python Pandas for Data AnalyticsIntroduction to Python Pandas for Data Analytics
Introduction to Python Pandas for Data AnalyticsPhoenix
 
PostgreSQL pour débutants
PostgreSQL pour débutantsPostgreSQL pour débutants
PostgreSQL pour débutantsLætitia Avrot
 

What's hot (20)

Component lifecycle hooks in Angular 2.0
Component lifecycle hooks in Angular 2.0Component lifecycle hooks in Angular 2.0
Component lifecycle hooks in Angular 2.0
 
Functional Programming in JavaScript by Luis Atencio
Functional Programming in JavaScript by Luis AtencioFunctional Programming in JavaScript by Luis Atencio
Functional Programming in JavaScript by Luis Atencio
 
Mock your way with Mockito
Mock your way with MockitoMock your way with Mockito
Mock your way with Mockito
 
Database Anti Patterns
Database Anti PatternsDatabase Anti Patterns
Database Anti Patterns
 
MySQL Indexing - Best practices for MySQL 5.6
MySQL Indexing - Best practices for MySQL 5.6MySQL Indexing - Best practices for MySQL 5.6
MySQL Indexing - Best practices for MySQL 5.6
 
The MySQL Query Optimizer Explained Through Optimizer Trace
The MySQL Query Optimizer Explained Through Optimizer TraceThe MySQL Query Optimizer Explained Through Optimizer Trace
The MySQL Query Optimizer Explained Through Optimizer Trace
 
Fundamental JavaScript [UTC, March 2014]
Fundamental JavaScript [UTC, March 2014]Fundamental JavaScript [UTC, March 2014]
Fundamental JavaScript [UTC, March 2014]
 
database application using SQL DML statements: all types of Join, Sub-Query ...
 database application using SQL DML statements: all types of Join, Sub-Query ... database application using SQL DML statements: all types of Join, Sub-Query ...
database application using SQL DML statements: all types of Join, Sub-Query ...
 
Routing & Navigating Pages in Angular 2
Routing & Navigating Pages in Angular 2Routing & Navigating Pages in Angular 2
Routing & Navigating Pages in Angular 2
 
Library Management System in c++
Library Management System in c++Library Management System in c++
Library Management System in c++
 
Introduction to Web Development Career
Introduction to Web Development CareerIntroduction to Web Development Career
Introduction to Web Development Career
 
Golang @ Tokopedia
Golang @ TokopediaGolang @ Tokopedia
Golang @ Tokopedia
 
MariaDB Temporal Tables
MariaDB Temporal TablesMariaDB Temporal Tables
MariaDB Temporal Tables
 
Dapper
DapperDapper
Dapper
 
An introduction to Google test framework
An introduction to Google test frameworkAn introduction to Google test framework
An introduction to Google test framework
 
More mastering the art of indexing
More mastering the art of indexingMore mastering the art of indexing
More mastering the art of indexing
 
为啥别读HotSpot VM的源码(2012-03-03)
为啥别读HotSpot VM的源码(2012-03-03)为啥别读HotSpot VM的源码(2012-03-03)
为啥别读HotSpot VM的源码(2012-03-03)
 
Cracking the Algorithm & Coding Interview
Cracking the Algorithm & Coding InterviewCracking the Algorithm & Coding Interview
Cracking the Algorithm & Coding Interview
 
Introduction to Python Pandas for Data Analytics
Introduction to Python Pandas for Data AnalyticsIntroduction to Python Pandas for Data Analytics
Introduction to Python Pandas for Data Analytics
 
PostgreSQL pour débutants
PostgreSQL pour débutantsPostgreSQL pour débutants
PostgreSQL pour débutants
 

Similar to BDD from QA side

resolvendo problemas de comunicação em equipes distribuídas com bdd
resolvendo problemas de comunicação em equipes distribuídas com bddresolvendo problemas de comunicação em equipes distribuídas com bdd
resolvendo problemas de comunicação em equipes distribuídas com bddRodrigo Urubatan
 
QA Fest 2018. Adam Stasiak. React Native is Coming – the story of hybrid mobi...
QA Fest 2018. Adam Stasiak. React Native is Coming – the story of hybrid mobi...QA Fest 2018. Adam Stasiak. React Native is Coming – the story of hybrid mobi...
QA Fest 2018. Adam Stasiak. React Native is Coming – the story of hybrid mobi...QAFest
 
...and thus your forms automagically disappeared
...and thus your forms automagically disappeared...and thus your forms automagically disappeared
...and thus your forms automagically disappearedLuc Bors
 
Behavior Driven Development
Behavior Driven Development Behavior Driven Development
Behavior Driven Development Dhawal Joshi
 
[QE 2018] Adam Stasiak – Nadchodzi React Native – czyli o testowaniu mobilnyc...
[QE 2018] Adam Stasiak – Nadchodzi React Native – czyli o testowaniu mobilnyc...[QE 2018] Adam Stasiak – Nadchodzi React Native – czyli o testowaniu mobilnyc...
[QE 2018] Adam Stasiak – Nadchodzi React Native – czyli o testowaniu mobilnyc...Future Processing
 
Moving away from legacy code with BDD
Moving away from legacy code with BDDMoving away from legacy code with BDD
Moving away from legacy code with BDDKonstantin Kudryashov
 
New Ideas for Old Code - Greach
New Ideas for Old Code - GreachNew Ideas for Old Code - Greach
New Ideas for Old Code - GreachHamletDRC
 
Taming the Legacy Beast: Turning wild old code into a sleak new thoroughbread.
Taming the Legacy Beast: Turning wild old code into a sleak new thoroughbread.Taming the Legacy Beast: Turning wild old code into a sleak new thoroughbread.
Taming the Legacy Beast: Turning wild old code into a sleak new thoroughbread.Chris Laning
 
North Virginia Coldfusion User Group Meetup - Testbox - July 19th 2017
North Virginia Coldfusion User Group Meetup - Testbox - July 19th 2017North Virginia Coldfusion User Group Meetup - Testbox - July 19th 2017
North Virginia Coldfusion User Group Meetup - Testbox - July 19th 2017Ortus Solutions, Corp
 
Gui application for e mail application
Gui application for e mail applicationGui application for e mail application
Gui application for e mail applicationUmesh Mk
 
3 Ways to test your ColdFusion API - 2017 Adobe CF Summit
3 Ways to test your ColdFusion API - 2017 Adobe CF Summit3 Ways to test your ColdFusion API - 2017 Adobe CF Summit
3 Ways to test your ColdFusion API - 2017 Adobe CF SummitOrtus Solutions, Corp
 
Rubyconf2016 - Solving communication problems in distributed teams with BDD
Rubyconf2016 - Solving communication problems in distributed teams with BDDRubyconf2016 - Solving communication problems in distributed teams with BDD
Rubyconf2016 - Solving communication problems in distributed teams with BDDRodrigo Urubatan
 
3 WAYS TO TEST YOUR COLDFUSION API -
3 WAYS TO TEST YOUR COLDFUSION API - 3 WAYS TO TEST YOUR COLDFUSION API -
3 WAYS TO TEST YOUR COLDFUSION API - Ortus Solutions, Corp
 
3 WAYS TO TEST YOUR COLDFUSION API
3 WAYS TO TEST YOUR COLDFUSION API3 WAYS TO TEST YOUR COLDFUSION API
3 WAYS TO TEST YOUR COLDFUSION APIGavin Pickin
 
Cross mobile testautomation mit Xamarin & SpecFlow
Cross mobile testautomation mit Xamarin & SpecFlowCross mobile testautomation mit Xamarin & SpecFlow
Cross mobile testautomation mit Xamarin & SpecFlowChristian Hassa
 
Getting your mobile test automation process in place - using Cucumber and Cal...
Getting your mobile test automation process in place - using Cucumber and Cal...Getting your mobile test automation process in place - using Cucumber and Cal...
Getting your mobile test automation process in place - using Cucumber and Cal...Niels Frydenholm
 
Intro To JavaScript Unit Testing - Ran Mizrahi
Intro To JavaScript Unit Testing - Ran MizrahiIntro To JavaScript Unit Testing - Ran Mizrahi
Intro To JavaScript Unit Testing - Ran MizrahiRan Mizrahi
 

Similar to BDD from QA side (20)

resolvendo problemas de comunicação em equipes distribuídas com bdd
resolvendo problemas de comunicação em equipes distribuídas com bddresolvendo problemas de comunicação em equipes distribuídas com bdd
resolvendo problemas de comunicação em equipes distribuídas com bdd
 
QA Fest 2018. Adam Stasiak. React Native is Coming – the story of hybrid mobi...
QA Fest 2018. Adam Stasiak. React Native is Coming – the story of hybrid mobi...QA Fest 2018. Adam Stasiak. React Native is Coming – the story of hybrid mobi...
QA Fest 2018. Adam Stasiak. React Native is Coming – the story of hybrid mobi...
 
...and thus your forms automagically disappeared
...and thus your forms automagically disappeared...and thus your forms automagically disappeared
...and thus your forms automagically disappeared
 
Behavior Driven Development
Behavior Driven Development Behavior Driven Development
Behavior Driven Development
 
[QE 2018] Adam Stasiak – Nadchodzi React Native – czyli o testowaniu mobilnyc...
[QE 2018] Adam Stasiak – Nadchodzi React Native – czyli o testowaniu mobilnyc...[QE 2018] Adam Stasiak – Nadchodzi React Native – czyli o testowaniu mobilnyc...
[QE 2018] Adam Stasiak – Nadchodzi React Native – czyli o testowaniu mobilnyc...
 
End-to-end testing with geb
End-to-end testing with gebEnd-to-end testing with geb
End-to-end testing with geb
 
Moving away from legacy code with BDD
Moving away from legacy code with BDDMoving away from legacy code with BDD
Moving away from legacy code with BDD
 
New Ideas for Old Code - Greach
New Ideas for Old Code - GreachNew Ideas for Old Code - Greach
New Ideas for Old Code - Greach
 
Taming the Legacy Beast: Turning wild old code into a sleak new thoroughbread.
Taming the Legacy Beast: Turning wild old code into a sleak new thoroughbread.Taming the Legacy Beast: Turning wild old code into a sleak new thoroughbread.
Taming the Legacy Beast: Turning wild old code into a sleak new thoroughbread.
 
North Virginia Coldfusion User Group Meetup - Testbox - July 19th 2017
North Virginia Coldfusion User Group Meetup - Testbox - July 19th 2017North Virginia Coldfusion User Group Meetup - Testbox - July 19th 2017
North Virginia Coldfusion User Group Meetup - Testbox - July 19th 2017
 
Gui application for e mail application
Gui application for e mail applicationGui application for e mail application
Gui application for e mail application
 
3 Ways to test your ColdFusion API - 2017 Adobe CF Summit
3 Ways to test your ColdFusion API - 2017 Adobe CF Summit3 Ways to test your ColdFusion API - 2017 Adobe CF Summit
3 Ways to test your ColdFusion API - 2017 Adobe CF Summit
 
BDD in iOS with Cedar
BDD in iOS with CedarBDD in iOS with Cedar
BDD in iOS with Cedar
 
Rubyconf2016 - Solving communication problems in distributed teams with BDD
Rubyconf2016 - Solving communication problems in distributed teams with BDDRubyconf2016 - Solving communication problems in distributed teams with BDD
Rubyconf2016 - Solving communication problems in distributed teams with BDD
 
3 WAYS TO TEST YOUR COLDFUSION API -
3 WAYS TO TEST YOUR COLDFUSION API - 3 WAYS TO TEST YOUR COLDFUSION API -
3 WAYS TO TEST YOUR COLDFUSION API -
 
3 WAYS TO TEST YOUR COLDFUSION API
3 WAYS TO TEST YOUR COLDFUSION API3 WAYS TO TEST YOUR COLDFUSION API
3 WAYS TO TEST YOUR COLDFUSION API
 
Code Refactoring
Code RefactoringCode Refactoring
Code Refactoring
 
Cross mobile testautomation mit Xamarin & SpecFlow
Cross mobile testautomation mit Xamarin & SpecFlowCross mobile testautomation mit Xamarin & SpecFlow
Cross mobile testautomation mit Xamarin & SpecFlow
 
Getting your mobile test automation process in place - using Cucumber and Cal...
Getting your mobile test automation process in place - using Cucumber and Cal...Getting your mobile test automation process in place - using Cucumber and Cal...
Getting your mobile test automation process in place - using Cucumber and Cal...
 
Intro To JavaScript Unit Testing - Ran Mizrahi
Intro To JavaScript Unit Testing - Ran MizrahiIntro To JavaScript Unit Testing - Ran Mizrahi
Intro To JavaScript Unit Testing - Ran Mizrahi
 

Recently uploaded

Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 

Recently uploaded (20)

Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 

BDD from QA side

  • 1. 1 BDD Frameworks Overview Shapin Anton August 19, 2016
  • 2. 2 • Lead Software Test Automation Engineer • 9+ years in IT • Areas of my competency: manual, automation, performance and etc. • Successfully completed more than 9 BDD projects. Email: anton_shapin@epam.com Skype: anton_shapin Shapin Anton
  • 3. 3 Agenda BDD approach1 Pros, cons, restrictions of BDD2 Coding tricks in Cucumber- JVM 3
  • 5. 5 Main questions: What is BDD ?1 Why do we need BDD ?2 What are the “bonuses” and minuses of BDD approach? 3 Where to begin?4
  • 6. 6 What customers see in BDD: We can understand what our automated tests are doing. 1 Executable specification.2 Reducing cost of test automation. 3 A better product.4 We can write clear tests in their native language. 5
  • 7. 7 What qa engineers see in BDD: Automated tests in native language. What is it? 1 Should we rewrite all of our tests?2 How we will maintain tests?3 Our tests will be unstable!4 It will be additional work (test-cases should be migrated to language of scenarios). 5
  • 8. 8 BDD approach BDD(behavior-driven development) - is a set of software engineering practices designed to help teams build and deliver more valuable, higher quality software faster. It draws on Agile and lean practices including, in particular, Test-Driven Development (TDD) and Domain-Driven Design (DDD). BDD isn’t a software development methodology in its own right. It’s not a replacement for Scrum, XP, Kanban, RUP, or whatever methodology you’re currently using. MAIN GOAL: EXECUTABLE SPECIFICATION
  • 10. 10 BDD Given describes the preconditions for the scenario and prepares the test environment. When describes the action under test. 2 Then describes the expected outcomes. 3 The And and But keywords can be used to join several Given, When, or Then steps together in a more readable way. 4 1
  • 11. Example of GUI Scenario Scenario: Running a Full Text Quick Search. Given I perform Quick Search by "IPhone 4S" When I click on link 'Search History' on panel 'Quick Search' Then the term query "IPhone 4S" should be the first in the Search History grid
  • 12. 12 BDD vs “Classical” style of test AUTOMATED TEST IN GERKHIN FORMAT(TEST IN BDD STYLE) AUTOMATED TEST IN “CLASSICAL” STYLE Scenario: Running a Full Text Quick Search. Given I perform Quick Search by "IPhone 4S" When I click on link 'Search History' on panel 'Quick Search' Then the term query "IPhone 4S" should be the first in the Search History grid @Test public void checkFullTextSearch() { homepage.open(); quickSearchForm.setSearchQuery(“IPhone 4S”); quickSearchForm.perform(); quickSearchForm.openSearchHistory(); searchHistory.isQueryTheFirst(“IPhone 4S”); }
  • 13. 13 How it works @Given("^I perform Quick Search by "([^"]*)" $") public void i_perform_quick_search_by(String query) { driver.findElement(By.id(“searchQuery”)).sendKeys(query); driver.findElement(By.id(“submit”)).click(); } Scenario: Running a Full Text Quick Search. Given I perform Quick Search by "IPhone 4S" ... Each step maps to Java Method
  • 14. 14 The main layers of a Cucumber test suite
  • 15. 15 BDD restrictions : BDD works very well only if the team of analysts, developers, testers are near, but not in different locations. 1 Work is performed on an isolated part of the product by a small team. 2 The system does not have tests with a complex structure of the test data. 3
  • 16. 16 Pros: The acceptance criteria are nice thought.1 We get executable specification.2 All test cases and automated tests are up to date.3 Application development time reduced.4 Test logic is in total independent layer of implementation. 5 Manual qa engineer can use automated test scenarios for manual testing. 6
  • 17. 17 Cons: It is not possible to do testing in the middle of the test. Checks are made only in the THEN section. 1 It's hard to maintain reusable steps in the scenarios. Very often it leads to duplication of code in the test system. 2 It is difficult to refactor tests.3 It is necessary to create and maintain the Domain Dictionary for writing tests. 4 The complexity of writing test scenarios without Helper-s (typos, say the phrase can be different). 5
  • 18. 18 Where to begin 1. Think, whether you need to BDD and formulate specific goals you want to achieve. 2. Read the book "BDD in Actions". 5. Very carefully think through the architecture of your test system (What? Where? Why? How?). 4. Create the initial version of the Domain vocabulary and rules for test scenarios writing. 3. Select the BDD framework. Examine the documentation carefully. !!! FORWARD !!!
  • 20. 20 Functional tests BACK-END TESTS (SERVICES, API and etc) UI TESTS (WEB APPLICATION) TYPES OF TESTS The scenarios should express what a user should be able to do, and NOT HOW. Very important is what a user should be able to do, and HOW
  • 21. 21 Step structure WHEN The user clicks the button “SAVE" in the Report Navigation Column on the Search Results page WHEN WHO NAME OF ACTION OBJECT OF ACTION AREA OF ACTION PAGE NAME LINK+<TITLE> BUTTON+<TITLE> TEXTBOX+<TITLE> … TABLE PANEL POP-UP MODAL FORM TAB … PAGE NAME CLICK SELECT … I THE USER
  • 22. 22 Step structure THEN the term "<query>" should be the first in the Search History grid on the My History page THEN WHAT SHOULD [NOT] BE AREA OF ACTION PAGE NAME TABLE PANEL POP-UP MODAL FORM TAB … PAGE NAME SHOULD BE SHOULD NOT BE The term …
  • 23. 23 Step structure WHEN The user performs the Full Search with parameters: query: “fish"; city: “Murmansk"; on the Home page COMPLEX WHO NAME OF ACTION OBJECT OF ACTION WITH PARAMETERS: PAGE NAME LINK+<TITLE> BUTTON+<TITLE> TEXTBOX+<TITLE> … PARAM:VALUE PAGE NAME PERFORM FILL … I THE USER
  • 24. Small tricks when working with Cucumber-JVM Scenario Outline: Running a Full Text Quick Search. Given I perform Quick Search by “<query>" When I click on link 'Search History' on panel 'Quick Search' Then the term query “<query>" should be the first in the Search History grid Examples: |query | | IPhone 4S | | BMW X5 |
  • 25. 25 Small tricks when working with Cucumber-JVM Given the user navigate to the Home page = Given the user open the Home page (?: navigate to|open) не равно (:? navigate to|open) /** * Open "Home page" */ @Given("^the user (?:navigate to|open) the Home page$") public void the_user_open_the_Home_page() { homePage.open(); }
  • 26. 26 Small tricks when working with Cucumber-JVM When the user navigates to “Simple” report type on the page ‘Results’ = When the user navigates to report type “Simple” on the page ‘Results’ @When("^I navigate to (?:"([^"]*)" report type|report type "([^"]*)" ) on page 'Results'$") public void I_navigate_to_report (String dataset, String dataset2){ if(dataset!=null) { // TODO: code goes here }else{ // TODO: code goes here } }
  • 27. 27 Small tricks when working with Cucumber-JVM Given I have 5 cucumbers in my basket = Given I have 1 cucumber in my basket @Given("^I have (d+) cucumbers? in my basket$") public void i_have_cucumber(int number) { // TODO: code goes here }
  • 28. 28 Small tricks when working with Cucumber-JVM Then the response should be JSON: """ [{"name":"BMW X5", "color": "Blue"}, {"name":"UAZ Patriot", "color": "Blue"}] """ @Then("^the response should be JSON:$") public void theResponseShouldBeJSON(String expectedJson){ // TODO: code goes here }
  • 29. IDE Helper (plugin for IDEA) to write steps of scenario • We can see all implemented steps when printing text of step • We can see full description of steps • Helper reduces time of step creation KEY POINTS
  • 30. Best Practices. Test Step Creation. User Helpers. For example IntelliJ IDEA plugin «Cucumber for Java»
  • 31. 31 Conclusion 1. BDD is a very good approach. But this is not a magic bullet. 2. Improper using will bring more problems than benefits. 5. Tests Stability and BDD usability depends on you. 4. Do not confuse the BDD and tests written in Gherkin. 3. To use or not to use BDD depends on situation and project.
  • 32. 32 Useful materials 1. Video: Useful practices of creation automatic tests by using Cucumber-JVM: https://goo.gl/ZftM9h 2. Video: From Manual to Automated Testing: https://videoportal.epam.com/video/noPgmXaX 5. Book: “Specification by Example” 4. Book: “Cucumber Recipes” 3. Book: “BDD in Actions” 6. Allure-cucumber-plugin: https://github.com/kirlionik/allure- cucumber-plugin
  • 33. 33 Thank you for attention! Email: anton_shapin@epam.com Skype: anton_shapin