Nathaniel Neitzke Lighthouse1, LLC nightski@gmail.com.

Post on 24-Dec-2015

218 views 0 download

Transcript of Nathaniel Neitzke Lighthouse1, LLC nightski@gmail.com.

BEHAVIOR DRIVEN DEVELOPMENT

Nathaniel Neitzke

Lighthouse1, LLC

nightski@gmail.com

Test driven development

Where did it come from?

What is it?

Why automated tests?

To verify correctness?

Confidence

Ability to change

Isolation

Debugging is hard, time consuming

Design

BDUF Goldplating

Documentation

What does this code do?

Testability

Send quality code to QA

So what’s wrong with tdd?

Focus on tests so it must be testing right?

Sapir-Whorf

The problem with “unit”

What is a unit? Unit test -> class

Programmers think…

I’m not going to write all those tests It’s really simple code, it doesn’t need to

be tested Testing is a waste of time I’ve done this all a million times (loops,

data retrieval, functionality, etc…)

Manager’s think…

We test after the code is done That’s what we have a testing person for We can’t spend that time now

Behavior driven development

TDD done very well Not about tests Think differently

Dan North/Aslak Hellesøy 2004

Specifications

Executable specifications around the behavior of your system

User stories

Conversation between customer and developer

Drive our executable specifications Role, feature, benefit

As a [role] I want [feature] so that [benefit]

Scenarios

Detail acceptance criteria for a particular user story

Context – Action – ObservationGiven [Context] When [Action] Then

[Observation]

FormatTitle (one line describing the story)

Narrative:As a [role]I want [feature]So that [benefit]

Acceptance Criteria: (presented as Scenarios)

Scenario 1:Given [context] And [some more context]…When [event]Then [outcome] And [another outcome]….

Scenario 2: ….

rspec & cucumber

Frameworks/Tools

DEMO

.NET Frameworks

NBehave, .NETSpec Machine.Specifications

Other Tools

TextMate/e Autotest Heckle Rake RCov

Resources Dan North

http://dannorth.net/introducing-bdd http://dannorth.net/whats-in-a-story

RSpec http://rspec.info/

Cucumber http://cukes.info/

IronRuby http://www.ironruby.net/

Beyond Test Driven Development Video http://video.google.com/videoplay?docid=8135690990081075324

The RSpec Book: BDD with RSpec, Cucumber, etc.. http://www.pragprog.com/titles/achbd/the-rspec-book

Questions?