17
Behavior-Driven Development One Team’s Exploration

Behavior-Driven Design: One Team's Exploration

  • Upload
    dtcoutu

  • View
    83

  • Download
    1

Embed Size (px)

DESCRIPTION

Looking into a team’s experience with adopting Behavior-Driven Development (BDD) and at answering these questions: - Why did we try it? - What tools and processes did we adopt? - How did it go?

Citation preview

Page 1: Behavior-Driven Design: One Team's Exploration

Behavior-Driven Development

One Team’s Exploration

Page 2: Behavior-Driven Design: One Team's Exploration

Behavior-Driven Development

Or…● BDD● Acceptance Test-Driven Development● Specification by Example● ...

Page 3: Behavior-Driven Design: One Team's Exploration

What is BDD?

● Focuses on specifying behavior instead of writing tests

● Defines a language for writing behaviors that can be executedo Gherkin - Given-When-Then statements

Page 4: Behavior-Driven Design: One Team's Exploration

Why use BDD?

● functional, end-to-end testing● communication

o with product ownero with team members

● documentation● building the right software

Page 5: Behavior-Driven Design: One Team's Exploration

What’s wrong with TDD?

● Nothing● Reading unit-tests harder for the business

Page 6: Behavior-Driven Design: One Team's Exploration

What tools & processes did we use?

We were building a REST service with Java, so…cucumber-jvm with groovy.● simplified step-definition (vs Java)Given(~'^an order with all details$') {->

@Given("^a vehicle exists$")public void a_vehicle_exists() throws Throwable {

Page 7: Behavior-Driven Design: One Team's Exploration

What tools & processes did we use?

● groovy - cucumber-spring integrationo wasn’t strong, but can be worked around

● Could’ve used unit testing directly

Scenario: place a valid order Given an order with all details When an order is placed Then a "CREATED" response is returned And the location of the new order is returned And a confirmation number is returned And the status is "ACTIVE"

def “place a valid order”() { given: “an order with all details” when: “an order is placed” then: “a CREATED response is returned” and: “the location of the new order is returned” and: “a confirmation number is returned” and: “the status is ACTIVE”}

Page 8: Behavior-Driven Design: One Team's Exploration

How did it go?

Page 9: Behavior-Driven Design: One Team's Exploration

Better Team Communication

Page 10: Behavior-Driven Design: One Team's Exploration

Less Assumptions

Clarified assumptions with the Given clauses

Page 11: Behavior-Driven Design: One Team's Exploration

Reviews and Unit Testing

Code review focus● Read tests first

Unit test changes● Used the Spock given-when-then structure, often with

comments, to explain the test similar to Cucumber.

Page 12: Behavior-Driven Design: One Team's Exploration

Product Owner Involvement

Product Owner never ended up looking at the tests

Page 13: Behavior-Driven Design: One Team's Exploration

Story Breakdown

Difficulty with scrum story breakdown and swarming● Starting with Cucumber

feature left us feeling constrained with how the next steps would happen.

● How to get more than two people on it and still feel effective?

Page 14: Behavior-Driven Design: One Team's Exploration

Others

More time consuming

Not everyone likes it

Page 15: Behavior-Driven Design: One Team's Exploration

What would I do differently?

● Continue working on involving product owner

● Create feature statements as part of story creation

● Demonstrate progress through test report

Page 16: Behavior-Driven Design: One Team's Exploration

Summary

● BDD was a good thing● I think we should continue the practice

o though stronger business involvement is needed for it to be truly effective

Page 17: Behavior-Driven Design: One Team's Exploration

Questions