Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Driving Behaviour with Cucumber
Search
Zach Dennis
March 20, 2012
Programming
2
600
Driving Behaviour with Cucumber
This is a talk I gave at the Great Lakes Software Excellence Conference in 2009 on BDD and Cucumber.
Zach Dennis
March 20, 2012
Tweet
Share
More Decks by Zach Dennis
See All by Zach Dennis
BTLE (Bluetooth Low Energy) and Core Bluetooth
zdennis
2
400
Sand Piles and Software - Madison Ruby Conference
zdennis
1
180
Intro to CoffeeScript
zdennis
2
300
Software and Sand Piles (Path to Agility, 2012)
zdennis
2
99
Sand Piles and Software (RailsConf 2012)
zdennis
3
640
JavaScript Code, Organization, and Patterns
zdennis
6
1.6k
Discovering Patterns
zdennis
5
390
Other Decks in Programming
See All in Programming
DDD, necessary but insufficient: physical design principles for microservices
cer
PRO
0
120
Catch Up with Swift 5.10
ojun9
1
450
LPIXEL×CADDi_kaerururu
kaerururu
3
270
マイ隙間家具OSSたちのご紹介
karupanerura
2
130
ADRを一年運用してみた/our_story_about_adr
hanhan1978
3
1.1k
Reckoner の Scala プロジェクトにおける オブザーバビリティの取り組み / Observability Initiatives in Reckoner's Scala Project
nomadblacky
0
820
「Hono遍歴」と「HonoXでブログ作成」
yasu551
0
170
私がエッジを使う理由
chimame
9
3.6k
Apple Vision Pro購入RTA 1泊3日弾丸ハワイツアー / RTA: Purchase Apple Vision Pro in Hawaii
yutailang0119
0
480
生成 AI の中身を覗いてみよう〜基礎から医療現場での応用まで〜
soh9834
2
700
C#でのPlaywrightを使ったE2Eテストの実際
tomokusaba
0
210
iOS / Android ネイティブ 実装アプリの Flutter 化事例
mthiroshi
0
650
Featured
See All Featured
Dealing with People You Can't Stand - Big Design 2015
cassininazir
355
22k
Code Review Best Practice
trishagee
54
15k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
11
1.4k
Build your cross-platform service in a week with App Engine
jlugia
223
17k
Documentation Writing (for coders)
carmenintech
59
3.7k
KATA
mclloyd
14
11k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
18
1.8k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
14
1.3k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
67
38k
The Cost Of JavaScript in 2023
addyosmani
13
3.7k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
219
21k
Why Our Code Smells
bkeepers
PRO
330
56k
Transcript
Driving Behaviour with Cucumber Zach Dennis Mutually Human Software www.mutuallyhuman.com
None
later... ...still joyful
a framework for writing and executing high level descriptions of
your software’s behavior
None
None
Cucumber is not a low level testing/specification framework.
Cucumber is a BDD tool
BDD was reframing of TDD
It has evolved into its own
Dan North’s 3 Principles of BDD
1. Enough is enough
2. Deliver stakeholder value
3. It’s all behaviour
how
None
I want ...
ok, why?
None
In order to reduce time managing contacts users should be
able to search for contacts within their account
In order to reduce time managing contacts users should be
able to search for contacts within their account value
In order to reduce time managing contacts users should be
able to search for contacts within their account role
In order to reduce time managing contacts users should be
able to search for contacts within their account behaviour
In order to reduce time managing contacts users should be
able to search for contacts within their account searching contacts
searching contacts details
searching contacts details Searching by name
searching contacts details Searching by name Searching by partial name
searching contacts details Searching by name Searching by partial name
Searching for non-existent person ...
searching contacts details Searching by partial name Given John Smith
exists And I’ve logged in as a user When I search for Jo Then I should see John Smith is found
Organizing
Project Management Tools
None
Code Stories Acceptance Criteria Today
Code Stories Acceptance Criteria Near Distant Future
Code Stories Acceptance Criteria Future
Stories Acceptance Criteria Code
None
identify the behaviour first
everything else
Outside-In
UX/IA/IxD Views Controllers Models Database
UX, IA, IxD
Views
Controller
Models
Database
An Example
In order to reduce time managing contacts users should be
able to search for contacts within their account
searching contacts details Searching by partial name Given John Smith
exists And I’ve logged in as a user When I search for Jo Then I should see John Smith is found
None
feature title
narrative
notes
acceptance criteria
scenario title
steps
Gherkin
PROJ_ROOT/ features/ step_definitions/ support/ searching_contacts.feature lib/ test/
cucumber features/searching_contacts.feature executable
None
None
pending steps
file/line numbers
step definition snippets
None
Given “John Smith” exists first step
PROJ_ROOT/ features/ step_definitions/ support/ searching_contacts.feature lib/ test/ people_steps.rb
features/step_definitions/people_steps.rb
watch it fail
watch it fail backtrace
None
make it pass
step becomes method invocation Given “John Smith” exists Given /^([^“]+)”
.../ step definition becomes method definition
capture groups become arguments
And I’ve logged in as a user 2nd step
features/step_definitions/people_steps.rb
watch it fail
None
make it pass
When I search for “Jo” 3rd step
features/step_definitions/search_steps.rb
watch it fail
add routes
still failing
add controller
still failing
add view
still failing
add search action
still failing
add the model
made it pass
Then I should see “John Smith” is found last step
features/step_definitions/people_steps.rb
None
make it pass
None
Rinse Repeat Lather
Stories In Features Out
None
None
features - customer audience tests/specs - developer audience
accurate, readable, executable, features
None
step tables
None
None
table#raw
None
table#hashes
None
table#rows_hash
scenario outlines
None
None
None
None
multi-line strings
None
background
None
None
tags tags
None
None
cucumber --tags @search, @wip
cucumber --tags ~@search,@wip
Hooks Transforms Framework Agnostic Wire Protocol Profiles
.NET - cuke4nuke
steps in .NET
JVM - cuke4duke
steps in java
steps in groovy
steps in scala
None
Resources • http://www.cukes.info • http://github.com/aslakhellesoy/cucumber • http://github.com/aslakhellesoy/cuke4duke • http://github.com/richardlawrence/Cuke4Nuke/