JBehave and Cucumber

JBehave and Cucumber are completely different frameworks, although meant for the same purpose: acceptance tests. They are based around stories (JBehave) or features (Cucumber). A feature is a collection of stories, expressed from the point of view of a specific project stakeholder. In your tests, you are referring to the stories, typically via regular expression matching.

JBehave is a pure Java framework whereas Cucumber is based on Ruby. Both are very mature frameworks. You can use Cucumber from Java via the Cuke4Duke Maven plugin from Maven, but there is still a language mismatch as it continues to use Ruby internally and you will need to install this language and its infrastructure (so-called ‘gems’) on the machine that runs your tests. This can be brittle and the language mismatch complicates both debugging and impedes performance of your tests. There is now a pure Java implementation of Cucumber which is called Cucumber-JVM. As of December 2011, it’s not released yet, but perfectly usable. This new framework is very similar to JBehave as both have native JUnit support.

The following is a comparison of Cucumber-JVM and JBehave.

Similarities: – JUnit support out of the box – Pure Java – Fast – Easy to use

Pros/Cons of JBehave: + Very good documentation + Pretty good HTML formatting of test results + Concurrent execution – Only supports stories, not features

Pros/Cons of Cucumber-JVM: + Supports features – Doesn’t support parallel JUnit tests. Will however work with parallel Maven 3 builds. – Lacking documentation – No pretty HTML formatting of test results, other than JUnit’s own formatting

If you are on a Java project, I would recommend either JBehave (if you are looking for great documentation) or Cucumber-JVM (if the support of features instead or stories is important to you).


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: