Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the differences between JBehave and Cucumber?

I have read somewhere that JBehave is actually the Java equivalent of Cucumber, whereas Cucumber is based on Ruby.

Can someone describe the differences between them provide links that do?

like image 890
Manoj Avatar asked Oct 31 '11 14:10

Manoj


People also ask

What is JBehave?

JBehave is a Java testing framework for Behavior-Driven Development (BDD.)

What is JBehave used for?

JBehave is a Behaviour Driven Development framework. It intends to provide an intuitive and accessible way for automated acceptance testing.

What is the difference between BDD and Cucumber?

BDD(Behavior Driven Development) BDD is an approach just like Agile whereas Cucumber is an automation tool that supports BDD but cucumber is not BDD.

Is Cucumber a BDD framework?

Cucumber Framework supports BDD Behaviour-driven Development (BDD) is a software development technique that has evolved from TDD (Test Driven Development), which is an approach or programming practice where the developers write new code only when the automated test case fails.


2 Answers

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 (edit: version 1.0.0 was released on March 27th, 2012). 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:

  • Pro Very good documentation
  • Pro Pretty good HTML formatting of test results
  • Con Only supports stories, not features

Pros/Cons of Cucumber-JVM:

  • Pro Supports features
  • Con Doesn't support parallel JUnit tests. Will however work with parallel Maven 3 builds.
  • Con Lacking documentation
  • Con No pretty HTML formatting of test results, other than JUnit's own formatting (edit: Cucumber-JVM now does support HTML output)

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).

I tried both frameworks and went for for Cucumber-JVM.

like image 83
cgleissner Avatar answered Sep 30 '22 22:09

cgleissner


Cucumber JVM is the Java implementation of the popular Cucumber BDD tool, as mentioned in the above answers.

JBehave has many additional configurations to fine-tune a BDD tool as per your preferences. But with those configurations come a great complexity too. At the end of the day, we are going Agile and we love being Lean in our work. The question you should ask from youself is whether these complex configurations add any significant value to your workflow. I have seen people doing BDD even without a powerful tool like Cucumber or JBehave. Some creates their own tools as well. My observation was, if you need a BDD tool, Cucumber has almost all the power you need.

For more insights, you may read this blog article written by me: JBehave Vs Cucumber JVM: Comparison and Experience Sharing

P. S. I feel like Stackoverflow is not the best community to ask subjective questions on tools. Anyways hope this discussion will be useful for someone.

like image 29
Thilina Ashen Gamage Avatar answered Sep 30 '22 21:09

Thilina Ashen Gamage