Default

How to run a single story in JBehave project?

How to run a single story in JBehave project?

In this tutorial, we will learn how to run a single story in a JBehave project. There are multiple ways to run a story in a JBehave project.

Add Story

First things first, add the JBehave story to the project with Gherkin syntax.

Write a simple JBehave story:

https://www.testingdocs.com/writing-simple-jbehave-story/

Step definitions

Add Step definitions java code for the story if needed or use reusable step definitions.

https://www.testingdocs.com/writing-step-class-for-a-jbehave-story/

In the story runner class define a filter for running a single class. We can pass this as command line parameter to the build tool.

Run a story

From command line we can specify the story filter to run a single story.

Linux Terminal command

$ mvn clean install -DstoryFilter=<story name>

Related

Running multiple stories in a JBehave project

https://www.testingdocs.com/questions/how-to-run-multiple-stories-in-jbehave-automation-project/

 

JBehave Tutorials

JBehave Tutorials on this website can be found at:
https://www.testingdocs.com/jbehave-framework-tutorial/