Site icon TestingDocs.com

JBehave Automation Story Components

Introduction

In this post, we will discuss writing the JBehave automation story. A story file is usually stored within a “.story” extension file. Also, it is usually called a story file.

JBehave Story components

An automation Jbehave story has 5 main components. ( although it might contain other parts like Examples table etc.)

1. Title

2. Meta: Meta information is mostly used to categorize the stories.

3. Narrative: Narrative is the description of the story i.e user story business description. The business flow consists of per-conditions, user actions, and expectations.

4. Scenario: A scenario is a collection of executable steps. A brief description of the scenario usually one-liner goes here. Also, a story can have multiple scenarios. Furthermore, steps are described below.

5. Steps: Steps are a user-based implementation of the story.

Given step represents a precondition to an event
When step represents the occurrence of the event
Then step represents the outcome of the event

 

Sample automation  story

To validate the ADD functionality of Calculator

Meta:
@Regression
@Automated

Narrative:
As a Calculator user
I want to add 2 integers with the add button
So, that I can verify the sum of added numbers Add functionality

Scenario: A user adds 2 integers and verifies the sum
Given I am a Calculator user
And I have two integer numbers to add
When I add the numbers with the plus button
Then I verify the sum of the two numbers

 

Recommendation

In conclusion, the stories contain references to the Step Java methods. Also, when you control-click on the text step the corresponding matched step method would be launched. Furthermore, it is always recommended to update the story file from within the IDE editor, so that you don’t miss out on any errors.

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

As the number of automation stories increases in number, it must be important to maintain some kind of hierarchy and group similar tests within the same hierarchy. This makes debugging and story management easy.

 

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

For more details on the JBehave framework, visit the official JBehave website at:
http://jbehave.org

Exit mobile version