This document discusses Behavior Driven Development (BDD) as an evolution of Test Driven Development (TDD) that focuses on writing specifications and documentation in a user-centric way. BDD helps developers understand where and what to test by focusing tests around user stories and specifying behaviors for different contexts rather than just asserting outcomes. Examples are given demonstrating how to write BDD specifications for a Stack data structure focusing on behaviors for different contexts like an empty stack or full stack. Tools for implementing BDD with languages like JBehave, JDave, and Instinct are also mentioned.
7. Developers dont know ...
where to start
what to test
what not to test
how much to test in one go
what to call tests
how to 鍖x a broken test
that TDD is about design
13. Behavior Driven Development
Its about writing speci鍖cations
Its about writing how the code works
Its about understanding how the system
works
Its about understanding what I have to write
14. BDD helps you realize
where to start outside-in
what to test user stories
what not to test anything else
how much to test in one go as little as possible
what to call tests intent
how to 鍖x a broken test documentation
that TDD is about design ......?!
15. Behavior
The actions or reactions of an object or
organism, usually in relation to the
environment. -- Wikipedia
Anything that an organism does involving
action and response to stimulation. --
Merriam-Webster
16. Example: Stack
Stack
as empty stack, ....
as full Stack, ....
neither empty nor full, ....
17. Example: Stack
Speci鍖cation
Stack
as empty stack, ....
as full Stack, ....
neither empty nor full, ....
18. Example: Stack
Stack Context
as empty stack, ....
as full Stack, ....
neither empty nor full, ....
19. Example: Stack
Stack
as empty stack, .... Behavior
as full Stack, ....
neither empty nor full, ....
20. Behavior of Empty Stack
Empty stack
is empty
is no longer empty after push
...
21. Behavior of Empty Stack
Empty stack Context
is empty Behavior
is no longer empty after push
...
22. How to Do It?
JBehave - 1.0.1
http://jbehave.org/
JDave - 0.9.0
http://www.jdave.org/
Instinct - 0.1.4
http://code.google.com/p/instinct/