Tip

Behavior-driven development: Five tips for keeping BDD projects on track

Many organizations are approaching software design in a new way, with one of the most popular being Behavior-driven development (BDD). Here are five tips to keep your BDD projects on track

Behavior-driven development is fast becoming a preferred method of software development for projects both large and small. John Smart, author of the book BDD in Action: Behavior-Driven Development for the Whole Software Lifecycle, offers a straightforward explanation of this technique. "BDD is an approach where you specify and design an application by describing its behavior from the outside." 

BDD is an approach where you specify and design an application by describing its behavior from the outside.

John Smart, author of Jenkins: The Definitive Guide

The benefits of behavior driven development are many. Here are just a few:

  1. The process itself is lean since there's no tolerance for gold-plating
  2. It's highly fluid and can evolve to meet emerging requirements
  3. It encourages good communication with stakeholders
  4. It helps ensure the delivery of a product that really works

This outside-in development method can require some changes in how software designers and developers think about projects. Here are five quick tips for getting BDD right.

  1. Determine the requirements by having stakeholders describe how they expect the system to behave. Agree on concrete examples of what this would look like in real life scenarios to flush out incorrect assumptions.
  2. Turn the stakeholder's examples into acceptance criteria that define what is developed. Then, automate these acceptance criteria.
  3. Think of each layer of code as a client for another layer of code.  A class that calls another class should be defined by its desired behavior. Turn these requirements into unit tests that are also described in terms of behavior.
  4. Ensure everything that's built contributes to implementing the expected behavior. Nip any fluff in the bud so all resources are directed toward meeting acceptance criteria.
  5. Create a continuous feedback look from the business to automated tests and back to the business in the form of test reports. When possible, make sure these reports are based on the original examples so stakeholders can see their goals being met.

And with these tips in mind, you can put behavior-driven design in action yourself!

What is your experience like with BDD? Let us know.

Dig Deeper on Software development best practices and processes