JBehave support in JSystem

JBehave support in JSystem

The BDD approach seems to gain popularity by the minute. One of the most popular frameworks that supports it in the Java language is JBehave. As a result, you may find the need to integrate a JBehave test (story), in one of you scenarios.

If this seems to be the cases, there is a very simple way to accomplish it. You can just use the JSystem JBehave system object.

First, locate the dependencies section in your test project POM file and add the system object artifact.


JBehave stories are composed of steps, which are Java classes and the stories which are plain text files. To run the story use the JSystemEmbedder class and specify in the class constructor all the step classes.

Invoke the runStoriesAsPathes method to execute the story.

	public void runJBehaveStory(){
		List<Class<?>> stepClasses = new ArrayList<Class<?>>();
		Embedder embedder = new JSystemEmbedder(stepClasses);

		List stories = new ArrayList();


The reports would be attached to the JSystem HTML report.

The sources of the system object can be found here. For a full example of a generic test that can execute any story browse to here.


View Itai Agmon's LinkedIn profileView Itai Agmon’s profile

Fork me on GitHub