Behavior-driven development catches on

By Paul Krill, InfoWorld |  Development, agile development, BDD 1 comment

Behavior-driven development (BDD), which helps users get more involved in describing an application's intended behavior, is becoming popular with developers, who are now latching on to tools that fit into the BDD vein. It's particularly relevant to agile application development approaches.

In BDD, application stakeholders as well, analysts, and testers are brought together to determine requirements. BDD features tests written in plain text. "Test-driven development, BDD, executable specifications -- all of that is becoming more popular and is the future," says agile development coach Warren Elliott.

How behavior-driven development works
BDD is an evolution of test-driven development that brings the customers into the picture, says Aslak Hellesoy, creator of the Cucumber BDD tool and a consultant at Norway's Bekk Consulting. BDD lets the customer write tests that everyone understands with assistance from developers and testers.

The BDD approach holds that an idea for a requirement can be turned into an implemented, tested, production-ready code as long as the requirement is specific enough that everyone knows what is going on, says developer Dan North of ThoughtWorks, who is credited with coining the term "BDD" around 2003. To do this, a way to describe the requirement is needed so that everyone from businesspeople to analysts, developers, and testers have a common understanding of the scope of the work. Parties agree on a common definition of "done."

In the BDD approach, a BDD "story" is developed, featuring a description of a requirement, a business benefit, and criteria for completeness. A story could be developed, for example, for an application for withdrawing cash from an ATM.

"BDD is about helping the customers, the stakeholders, have this slightly structured conversation with the delivery team," North says. "[BDD is] allowing people to write better software," he says, adding that it enables a focus on just delivering features.

Hellesoy advises against using BDD in a traditional, waterfall method of application development. "I would only use it on an agile project," he says, because BDD treats the specification as a living, changing document. "You can't possibly come up with it up front," he says, which methods such as waterfall require.

Tools leveraging BDD concepts include Cucumber, RSpec, JBehave, and FitNesse. They focus on different aspects of application development and testing, so can be complementary.

Cucumber is a current BDD darling
Cucumber drew crowds at the RailsConf 2009 conference in Las Vegas in early May. As of May, Cucumber had been downloaded about 40,000 times since its first release eight months ago. "I love Cucumber," says Martin Emde, a lead developer at Naughty America, an adult entertainment venture. "It gives me something to show my bosses, so my boss knows what it is that the application really does," he says, "There's a clarity in communication."

"The reason Cucumber interests me is it's a little more expressive than FitNesse," with developers able to write business scenarios and execute them against code, says app dev coach Elliott. Developers can work with an executable rather than just a Word or HTML document, he notes. "Cucumber has a long lineage" dating to 2003, Hellesoy says, and is written in the Ruby language. "The Ruby community didn't have a tool to do what the Java people have," he notes.

Cucumber features a small domain-specific language that domain experts can extend to their own vocabulary. "All organizations have their own lingo and their expressed requirements in that lingo. So you can take Cucumber and extend it to whatever lingo you're using," Hellesoy says.

RSpec follows the unit-testing model
Another tool in the BDD testing vein, RSpec, differs from Cucumber, Hellesoy says. Geared for programmers, RSpec is for programmers to write tests for classes, objects, and methods. Cucumber, however, allows nonprogrammers to specify how a system should behave, he notes.

"Put simply, Cucumber is business-facing and RSpec is developer-facing," says David Chelimsky, lead developer and maintainer of RSpec and the rspec.info Web site. "Cucumber lets you automate scenarios using an application," he says. "RSpec is something closer to what most people would call unit testing," in which individual parts of an application are tested in isolation, Chelimsky says.

FitNesse is popular for agile acceptance testing
FitNesse, meanwhile, is billed as a software collaboration tool enabling customers, testers, and programmers to learn what their apps should do. Customer expectations are compared to actual results. The FitNesse.org site claims that "it's an invaluable way to collaborate on complicated problems (and get them right) early in development."

"FitNesse is probably the most popular agile acceptance testing tool around," says Gojko Adzic, an early adopter of FitNesse who has written extensions for it. "Agile acceptance testing and BDD share quite a lot of the same ideas. BDD insists on inside-out feature-driven design, where acceptance testing stops short of telling you how to implement the specification, but everything else is in my mind the same. So you can use FitNesse for that." But developers will want to use tools such as Cucumber, JBehave, and RSpec for the BDD part of their development efforts, he adds.

1 comment

    Anonymous 2 years ago
    Hi, I am currently looking for a candidate with experience with Cucumber for a company in Atlanta. It is a bit challenging to find a candidate since this is such a new technology. Can you help point me in a direction? I was hoping to speak with a teacher that recently taught a class on the subject in hopes that he/she could let her top students know about the opportunity. Any advice that you could give me would be very much appreciated. rlenz@apexsysemsinc.comThanks, Becky

      Add a comment

      Post a comment using one of these accounts
      Or join now
      At least 6 characters

      Note: Comment will appear soon after you have activated your account.
      Obscene/spam comments will be removed and accounts suspended.
      The information you submit is subject to our Privacy Policy and Terms of Service.

      ITworld LIVE

      DevelopmentWhite Papers & Webcasts

      White Paper

      HP NonStop SQL Fundamentals whitepaper

      This whitepaper offers a detailed look into the fundamentals of HP NonStop SQL solutions. See how this system delivers unprecedented levels of application availability with fail-safe data integrity and meets the needs of enterprises with large-scale business critical applications.

      White Paper

      Nebraska Medical Center case study

      See how the Nebraska Medical Center implemented a SQL solution to make information more readily available to streamline operations, improve patient care and facilitate medical research with an enterprise solution running on HP NonStop servers.

      White Paper

      Concepts of NonStop SQL/MX

      For DBAs and developers who are familiar with Oracle solutions and want to learn about NonStop SQL/MX, this whitepaper provides an overview of the similarities and differences between the two products-with a specific focus on implementation.

      White Paper

      6 Things Your CIO Needs to Know About Requirements

      If your organization is not predictably successful on technology projects, there is likely an issue in requirements. CIOs must take action and own requirements maturity improvement. There are 6 main things a CIO must know about requirements.

      Webcast On Demand

      User Experience Monitoring

      In this webinar, you will learn hints & tips for improving end-user response times from Forrester Research analyst, Jean-Pierre Garbani.

      Sponsor: Nimsoft

      See more White Papers | Webcasts

      Ask a question

      Ask a Question