際際滷

際際滷Share a Scribd company logo
v0
                                             .1-
                                                 al
                                                 ph
                                                   a
                    !"

B"#$v%&'r-Dr%v"(
  Pr&)r$**"r
The 鍖rst steps of a Behaviour-Driven Developer
Julien Biezemans
     @jbpros
Who?
You happen to write code...
useless,
delivered (too) late,
fragile,
difficult to deploy,
impenetrable,
hard to maintain.
BDD
Dan North
@tastapod
BDD is a second-generation, outside-
in, pull-based, multiple-stakeholder,
multiple-scale, high-automation,
agile methodology.
It describes a cycle of interactions
with well-de鍖ned outputs, resulting in
the delivery of working, tested
software that matters.
Test-Driven
Development
Red, Green, Refactor
Where to start?
What to test?
Behaviour
The Behaviour-Driven Programmer
From Test to
 Behaviour
Most important missing
  behaviour today?
Business value
Story
As ...
I want ...
So that ...
Estimation
Acceptance criteria
Scenario
Context  Event  Outcome
Given  When  Then
Ubiquitous Language
BDD in Ruby/Rails
Stories + Scenarios
           =
Cucumber features
Cucumber
http://github.com/cucumber
Full-stack, deliverable
Outside-in
Acceptance tests


Unit tests


Code
The Behaviour-Driven Programmer
The Behaviour-Driven Programmer
Run feature
The Behaviour-Driven Programmer
Missing step definition
         #fail
Write step definition
features/step_definitions/tamagotchi_steps.rb
bin/app.rb
Run feature
The Behaviour-Driven Programmer
Missing code
   #fail
RSpec
http://github.com/rspec
Write spec
spec/lib/tamagotchi_spec.rb
Run spec
The Behaviour-Driven Programmer
Missing code
   #fail
Make it pass
lib/tamagotchi.rb
The Behaviour-Driven Programmer
Refactor
Repeat until the
 feature passes
The Behaviour-Driven Programmer
Design
spec/lib/tamagotchi_spec.rb
spec/lib/tamagotchi_spec.rb
The Behaviour-Driven Programmer
lib/tamagotchi.rb
The Behaviour-Driven Programmer
lib/tamagotchi.rb
The Behaviour-Driven Programmer
spec/lib/tamagotchi_spec.rb
The Behaviour-Driven Programmer
Stubs
spec/lib/tamagotchi_spec.rb
The Behaviour-Driven Programmer
lib/tamagotchi.rb
The Behaviour-Driven Programmer
spec/lib/tamagotchi_spec.rb
spec/lib/tamagotchi_spec.rb
The Behaviour-Driven Programmer
The Behaviour-Driven Programmer
Spec everything your
step definitions need
spec/lib/tamagotchi_spec.rb
lib/tamagotchi.rb
The Behaviour-Driven Programmer
The Behaviour-Driven Programmer
spec/lib/tamagotchi_spec.rb
lib/tamagotchi.rb
The Behaviour-Driven Programmer
The Behaviour-Driven Programmer
features/step_definitions/tamagotchi_steps.rb
The Behaviour-Driven Programmer
The Behaviour-Driven Programmer
The Behaviour-Driven Programmer
The Behaviour-Driven Programmer
Living documentation
Ruby on Rails
View  Controller  Model
From Programmer
   to Developer
program v.
To provide (a machine) with
a set of coded working
instructions.
develop v.
To bring out the capabilities
of; bring to a more advanced
or effective state.
Deliberate discovery
Know what
you dont know
Know what
you dont know
you dont know
Learn the domains
Learn the tools
Know the people
Feedback
Real options
Practice
Your code is now...
useful,
delivered on time,
robust,
easily deployable,
intelligible,
maintainable,
A piece of software
   that matters.
Dont deliver features
Ship

capabilities!

More Related Content

The Behaviour-Driven Programmer