Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Behavior Driven Development

1,010 views

Published on

Published in: Technology, Business
  • Be the first to comment

Behavior Driven Development

  1. 1. Behavior Driven Development Chun-Wen Wang Aug 21, 2007
  2. 2. Background
  3. 3. TDD
  4. 4. Test Driven Development
  5. 5. Problem
  6. 6. Developers don’t know ... • where to start • what to test • what not to test • how much to test in one go • what to call tests • how to fix a broken test • that TDD is about design
  7. 7. Test?
  8. 8. Assert?
  9. 9. Sapir-Whorf hypothesis
  10. 10. BDD
  11. 11. Behavior Driven Development • It’s about writing specifications • It’s about writing how the code works • It’s about understanding how the system works • It’s about understanding what I have to write
  12. 12. 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 fix a broken test documentation • • that TDD is about design ......?!
  13. 13. 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
  14. 14. Example: Stack • Stack • as empty stack, .... • as full Stack, .... • neither empty nor full, ....
  15. 15. Example: Stack • Specification Stack • as empty stack, .... • as full Stack, .... • neither empty nor full, ....
  16. 16. Example: Stack • Stack Context • as empty stack, .... • as full Stack, .... • neither empty nor full, ....
  17. 17. Example: Stack • Stack • as empty stack, .... Behavior • as full Stack, .... • neither empty nor full, ....
  18. 18. Behavior of Empty Stack • Empty stack • is empty • is no longer empty after push • ...
  19. 19. Behavior of Empty Stack • Empty stack Context • is empty Behavior • is no longer empty after push • ...
  20. 20. 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/
  21. 21. Example (JDave)
  22. 22. < >
  23. 23. Example using RSpec
  24. 24. </ >
  25. 25. Further More
  26. 26. Discussed Not yet Module Under Test
  27. 27. Mock Objects
  28. 28. ... aren’t Stubs
  29. 29. To be continued...
  30. 30. Q &A

×