Sunday, August 5, 2018

JBehave Hello World example (Eclipse + Maven + JUnit)

JBehave is a framework for Behaviour-Driven Development (BDD). To know more about JBehave, click here.

Below is the eclipse folder structure -

Please create a maven project and add the following files -


This contains the hello world business logic that need to be tested using JBehave

This file contains the test cases

This file contains the steps for BDD testing

This is the main test class from where we can trigger various stories for testing. Using InjectableStepsFactory you can provide list of Steps classes, in our case it is
It also provides the configuration used by the Embedder and the in the Embeddable implementations to customise its runtime properties.

Now compile the maven project using mvn clean build command. It show show BUILD SUCCESS message.

Now run the (Right click on -> Run As -> JUnit Test)

Console Output

Also you can find the JBehave repots in JBehaveHelloWorld\target\jbehave\view folder

Reports in target folder

Generated JBehave report