TestingDocs.com
Software Testing website
  • Automation
    • Selenium
    • JBehave Framework
  • Tutorials
    • MySQL Tutorials
    • Testlink
    • Maven
    • Git
  • IDEs
    • IntelliJ IDEA
    • Eclipse
  • Flowcharts
    • Flowgorithm
    • Raptor
  • About

JBehave

Write Simple JBehave Story

JBehave

Introduction

In this tutorial. we will write a simple JBehave story in Eclipse IDE. This post is suitable for beginners who want to kick start BDD using JBehave. If you haven’t installed the JBehave Eclipse plugin, we recommend looking at the post( Installing JBehave Eclipse Plugin )

Adding a new story in Eclipse

Once you have an Eclipse plugin successfully installed, you would get the new story in the New Wizard window. Click on it to create a new story as shown in the picture.

Story Components

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

 

We can have multiple scenarios in a single file. But for simplicity sake, I will write 2 simple scenarios for a calculator addition and subtraction of two numbers lets say Calculator .story. Typically, each line in the story gherkin would be mapped to a java method in step classes (POJOs). For example, in our case, let’s call it CalcSteps. For easy understanding see the diagram below for better understanding.

 

Simple_JBehave_Story

 

Besides, some steps might be common for a lot of scenarios we can move them to CommonSteps. These can be reused across multiple stories and Scenarios.

Sample JBehave story

Scenario: ADD function

Given numbers i and j
When we add them
Then verify the sum

Scenario: SUBTRACT function

Given numbers i and j
When we subtract i from j
Then verify the difference

 

In the next post, we write the step classes and connect the pieces and run the story from within the Eclipse IDE.

https://www.testingdocs.com/jbehave-ambiguous-steps/

 

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

Related Posts

Create a New Project Eclipse

JBehave /

Cucumber Java BDD Selenium Framework

JBehave + Serenity Sample Project

JBehave /

JBehave + Serenity Sample Project

Serenity BDD Automation Framework

JBehave /

Serenity BDD Automation Framework

Serenity Maven Artifacts

JBehave /

Serenity Maven Artifacts

Introduction to Serenity BDD

JBehave /

Introduction to Serenity BDD

‹ Install JBehave Eclipse Plugin› JBehave Automation Story Components

Recent Posts

  • Update draw.io on Windows
  • Install RAPTOR Avalonia on CentOS
  • Download RAPTOR Avalonia Edition on Windows
  • npm doctor command
  • Build & Run CLion Project
  • Create New CLion C Project on Windows
  • Configure CLion Toolchains on Windows
  • Launch CLion IDE on Windows
  • Activate CLion IDE
  • CLion IDE for C/C++ Development

Back to Top

Links

  • Contact
  • Privacy Policy
  • Cookie Policy

www.TestingDocs.com