This week's book giveaway is in the Reactive Progamming forum.
We're giving away four copies of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams and have Adam Davis on-line!
See this thread for details.
Win a copy of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams this week in the Reactive Progamming forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

BDD with JUnit

 
clojure forum advocate
Posts: 3479
Mac Objective C Clojure
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi.
Recently, I'm trying to dig more in the agile development, tesing, continuous integration.
I have been reading about "Behaviour Driven Development"
I found a library called: jBehave
Why we need jBehave? why we can't use JUnit or TestNG for BDD?
Thanks.
 
author & internet detective
Posts: 39528
776
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
John,
You can use plain JUnit or TestNG. JBehave is designed to make things easier. For example, it looks like JBehave uses behavior/story language.
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
John, the most visible difference between BDD and TDD is in the vocabulary and people have written tools such as JBehave to reflect that. Whereas in JUnit 3.x we used to identify tests with the "test" prefix in a method name, in JBehave you identify them with "should".

In other words, tools such as JBehave or JDave just give you a different "language" to express your tests (or behavior definitions, or specifications) with. You can do BDD with JUnit - you just have to sprinkle the word "test" around your behavior definitions.
 
Hussein Baghdadi
clojure forum advocate
Posts: 3479
Mac Objective C Clojure
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Lasse Koskela:
Whereas in JUnit 3.x we used to identify tests with the "test" prefix in a method name, in JBehave you identify them with "should".


Lasse,
Any reason you didn't mention JUnit 4?
For a project, do you suggest to employ both libraries (JUnit and JBehave for example), or to use only one?
 
Lasse Koskela
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by John Todd:
Any reason you didn't mention JUnit 4?


In JUnit 4 you don't need to prefix your test methods' names with anything. As I was referring to prefixes like "testXxx" and "shouldXxx", it just didn't feel necessary to mention JUnit 4.

Originally posted by John Todd:
For a project, do you suggest to employ both libraries (JUnit and JBehave for example), or to use only one?


Yes and yes.

There's value in keeping the setup simple - thus, use just one.
There's value in using the best tool for the job - thus, use both if you feel like it.

In other words, there's no one correct answer to this.
 
You are HERE! The other map is obviously wrong. Better confirm with this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!