JBehave 2.0 is live!

Some ancient history

Back in 2003 I started work on a framework called JBehave. It was an experiment to see what JUnit might have looked like if it had been designed from the ground up for TDD rather than as a unit testing framework. I was also starting to use the phrase “behaviour-driven development” to describe what I meant. The jbehave.org domain was registered and the first lines of code written on Christmas Eve 2003, much to my wife’s bemusement. Over time JBehave grew a much more interesting aspect in the form of a framework for defining and running scenarios, or automated acceptance tests.

Since JBehave wasn’t based on JUnit there was always going to be a barrier to adoption in the form of IDE integration and build tools, among other things. It also failed the First Law of Frameworks in that it wasn’t harvested from real life—it was just an extended thought experiment. As a result it turns out it was a bit of a cow to use. Mea culpa.

Some recent history

Many of the ideas from JBehave have since appeared in other BDD frameworks, particularly in the lovely rspec. Although I wrote the first cut of the scenario runner in rspec it has since been thoroughly reworked and improved beyond all recognition1 by the efforts of David Chelimsky and his team. The biggest single improvement has been the introduction of plain text stories, which allow you to separate the scenario text from any of the automated steps they refer to.

Over the last few months, Liz Keogh and Mauro Talevi have completely rewritten JBehave from the ground up, taking advantage of new Java 5 language features and using JUnit 4 as the underlying execution framework.

By using real project examples to drive the design—including using it in their day jobs—they have produced what I believe is a powerful and very usable behaviour-driven development framework for Java. In particular Liz decided she wanted plain text scenarios and the idea of a “pending” scenario—something that you have identified but not yet implemented.

And now…

We’ve released it! JBehave 2 has only been live for a few days and already ThoughtWorks colleague Ryan Greenhall has written an excellent tutorial demonstrating how to use it. Quoting the release announcement on the site, JBehave 2 supports the following feaures:

  • Plain text scenarios
  • Support for multiple scenarios in a file
  • Pending scenarios (the “Amber Bar”)
  • Clear, easy-to-read output from failures and pending scenarios
  • Maven support
  • Parameter capture from scenarios
  • Conversion of parameters to your own objects
  • Support for multiple languages and scenario terminology
  • A high degree of configurability

Go download JBehave 2 and take it for a spin, and let me know what you think. The mailing lists are waiting for you too.

  1. Aslak Hellesøy is currently working on a replacement for the rspec scenario runner called Cucumber which looks very promising. ↩︎