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
610
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
190
Intro to CoffeeScript
zdennis
2
300
Software and Sand Piles (Path to Agility, 2012)
zdennis
2
100
Sand Piles and Software (RailsConf 2012)
zdennis
3
650
JavaScript Code, Organization, and Patterns
zdennis
6
1.6k
Discovering Patterns
zdennis
5
390
Other Decks in Programming
See All in Programming
ファイル先頭の use の意味、説明できますか? 〜PHP の namespace と autoloading の関係を正しく理解しよう〜 / namespace and autoloading in php
okashoi
2
470
OpenTelemetry のサービスという概念について
azukiazusa1
1
410
MySQL のインデックスの種類をおさらいしよう! / overviewing indexes in MySQL
okashoi
0
170
オブジェクトしこう
okuramasafumi
2
130
孤独のCTOグルメという やや奇抜な企画をやった目的と効果
shoheimitani
3
1k
品質が高いコードって何?Rev2.1
ickx
1
490
Parallel Socket Communication in Swift
s_shimotori
0
250
両面どころかインフラもTSでできるよ ~ 全方位TypeScriptによるプロダクト開発 ~
myfinder
9
2.4k
決断するための勇気、そのためのBacklog / Courage to make decisions, Backlog for that.
seike460
PRO
4
1.9k
Prepare for Jakarta EE 11 - Performance and Developer Productivity
ivargrimstad
0
510
Go1.22からの疑似乱数生成器について/go-122-pseudo-random-generator
convto
1
160
もうすぐ新年度、Babylon.jsがお勧めな3個の理由
hideg
0
170
Featured
See All Featured
Learning to Love Humans: Emotional Interface Design
aarron
266
39k
Agile that works and the tools we love
rasmusluckow
323
20k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
225
51k
It's Worth the Effort
3n
180
27k
A designer walks into a library…
pauljervisheath
199
23k
Optimising Largest Contentful Paint
csswizardry
7
2.3k
Testing 201, or: Great Expectations
jmmastey
27
6.3k
Atom: Resistance is Futile
akmur
258
25k
Building Your Own Lightsaber
phodgson
97
5.6k
Gamification - CAS2011
davidbonilla
76
4.5k
Teambox: Starting and Learning
jrom
126
8.4k
RailsConf 2023
tenderlove
0
510
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/