Saturday, September 28, 2013

I saw Jason Harmon speak on Behavior-driven development at the Austin API meetup at uShip on Wednesday night.

He asserted that BDD* (behavior-driven development) is not good for testing and no rival to TDD (test-driven development). Mr. Harmon did argue that the Gherkin descriptive rules and their Given/When/Then imperative style are beneficial for articulating how an application works in a layman's way in lieu of a syntactical way, thus allowing DDD (domain-driven design) concepts to bubble up into something visible to non-technical minds. He has a slide with BDD, TDD, and DDD sitting within three separate and overlaying circles. He suggested that you needed all three intertwined and that they should all love each other (my words, not his). Another slide suggested:

  • Devs know how to build it
  • Testers know how to test it
  • Product knows how to sign off
  • Documentation has a head start
  • Stakeholders know what they're getting

 
 

Yes! I managed to make the ordered list above without having the bullets from the ordered list overlay the floating image I have of Jason Harmon in Internet Explorer. That has been a problem in all of my other postings of late. Now the bullet points are just hidden beneath the image and I can live with that. Anyways, I digress. Tools for BDD include:

  • Cucumber is for Ruby.
  • Cucumber-JVM is for Java.
  • SpecFlow is for ASP.NET
  • Lettuce is for Python

 
 

An imperative style example follows. It gives a readable English description of how a product behaves or how a product will eventually behave when the spec is met. There is also a declarative style to Gherkin which is less verbose and more abstract, but the example below is of the imperative style instead.

Scenario: Get nearby places name
   Given I use the geonames host
   When I access the resource url "/findNearbyPlaceNameJSON"
   And I provide parameter "username" as "jharmon"
   And I provide parameter "lat" as "30.4754724"
   And I provide parameter "lng" as "-98.1564068"
   And I retrieve the JSON results
   Then then status code should be 200
   And it should have a list "geonames"
   And the list should have at least 1 item

 
 

Circling back to my mid-blog-posting distraction, I will offer that I use the following HTML for the image you see:

<div style="width: 260px; height: 830px; float:left;">
   <div style="width: 620px; height: 830px; margin-left: -380px;">
      <div style="width: 620px; height: 830px; z-index: 10; position: absolute;">
         <img src="http://www.tomjaeschke.com/blog/JasonHarmon.jpg" />
      </div>
   </div>
</div>

 
 

*Addendum: Mr. Harmon tweeted me with: @jaeschke Great writeup, but 1st sentence lost me. To clarify, BDD is good for AC testing, TDD is good for unit testing. Different layers :)

No comments:

Post a Comment