BDD With Cucumber
MÜCAHİT KURT
Sn. Project Manager @ INNOVA
@mucahitkurt
Mücahit KurtSn. Project Manager
@mucahitkurt
@mucahitkurt
@mucahitkurt
mucahit.blogspot.com.tr
2
Test Pyramid
3
GUI Tests
API Tests
Integration Tests
Component Tests
Unit Tests
Manuel
Tests
GUI Tests
API Tests
Integration Tests
Component Tests
Unit Tests
Manuel Tests
How it should be done What many teams do
BDD Concept
“Using examples in conversation to illustrate behaviour.”
4
Specification by Example
Acceptance TDD
Extented TDD BDD
Why BDD?
5
Communication
Collaboration
Automation
Living Documentation
Traditional
6
Analyst Developer
Tester
Deployment
Bug Report
Requirements
Clarify
Collaboration
7
Analyst
Developer
Tester
Deployment
Bug Report
Requirements
Clarify
Specifications
Developer Analyst
Three Amigos
Tester
Cucumber is the Tool
8
Features
Scenarios
Steps
Cucumber
9
Your Project
Features
Scenarios
Steps
Step Definitions
Support Code
Automation Library
Your System
Business
Facing
Technology
Facing
Sample Feature
10
Language
Feature
Scenario
Steps
Gherkin is the Language
11
Cucumber supports over 60 spoken languages.
Step Definitions
12
Regular Expressions
13
http://regexr.com
How it Works?
14
Execute
Scenario
Read First Step
Do we have a matching
step definition?
Execute Step
Definition Code
Block
Was an
exception
thrown?
Any more
steps?
Passed Scenario Failed Scenario
Pending
Scenario
Undefined
Scenario
Pending
Read next step
No
Yes
No
No
Yes
No
Yes
Yes
Expressive Scenarios
Background, Data Table, Scenario Outline, Tag, Hook
15
Outside-in
16
Failing
Acceptance
Test
Failing
Unit
Test
Make it
Pass
Refactor
17
Exercise
Keeping Your
Cucumbers Sweet
Don’t forget the test pyramid
Work together
Care your tests & codes
18
Environment
Parallel Run
19
Jenkins-Plugin-Parallel Run
Reporting
Different sets with tags
Spring, Pico-Container, Selenium etc. support
Conclusion
Collaboration on requirements builds trust between
stakeholders and delivery team members
Collaboration requires preparation
Looking at the end goal as business process
documentation is a useful model
Long-term value comes from living documentation
20
References
The Cucumber For Java Book
By Seb Rose, Matt Wynne, Aslak Hellesoy
Specification By Example
By Gojko Adzic
21
End of the Fun
22
Credits
23
• Three feathers by Deb, https://www.flickr.com/photos/25154062@N02/5522723111/
• analyst by Gregor Črešnar from the Noun Project
• percentage by Gregor Črešnar from the Noun Project
• Money by Gregor Črešnar from the Noun Project
• Value by Gregor Črešnar from the Noun Project
• Search by Luis Prado from the Noun Project
• User by Wilson Joseph from the Noun Project
• bug by Robert Bjurshagen from the Noun Project
• cycle by Robert Bjurshagen from the Noun Project
• Checklist by Davo Sime from the Noun Project
• question-mark by Cris Dobbins from the Noun Project
• Cross by Zaff Studio from the Noun Project
• Back-ache !!!!!!!!!!! by Craig Sunter, https://www.flickr.com/photos/16210667@N02/9046360969
• Lemur up there by Tambako The Jaguar, https://www.flickr.com/photos/tambako/13662196145/

BDD with the Cucumber