TestingDocs.com
Software Testing website
  • Automation
    • Selenium
    • TestNG
  • Tools
    • Testlink
    • Maven
    • Git
  • IDEs
    • IntelliJ IDEA
    • Eclipse
  • Flowcharts
    • Flowgorithm
    • Raptor
  • About

JBehave

Serenity BDD Automation Framework

JBehave

Introduction

In this tutorial, we will look at the key components of Serenity BDD Automation framework. There are many components that make up an automation project. Let’s touch upon some of the key components.

Sample Project Structure

serenity-jbehave-project

+ pom.xml
+ src
 + main
 + java
 + com
 + testingdocs
 + serenity
 + automationProject
 + pages
 + steps
 + AcceptanceTestSuite.java
 +test
 + resources                 ------------  configuration files and
 .propertiesfiles
 + stories         ------------ textual .story file stories
 + storyData     ------------ any story data used in the stories.

+ drivers     --------------- browser web driver .exe's

 

Key components

Steps are java classes where a JBehave step is implemented for a human-readable textual Gherkin. Using Serenity BDD Framework, tests are broken into reusable steps. It is not necessary to create a new step class when you are creating a story. So, there isn’t any relation between stories and step classes.

 

Story narrative format:

Narrative:
As a Customer <User>
I want to <perform task>
In order to <achieve goal / benefit>

Note that BDD encourages us to put as much information in the stories.

Sample PageObject

PageObject is a way of abstracting or isolating the implementation details of a webpage inside a java class. They are several ways to design Page objects are only concerned with the business logic related to that webpage. Any page object class that we design might need to extend Serenity Page Object. If you do so, Serenity provides a number of utility methods that make page objects more convenient to work with. PageObjects make the web tests much more maintainable.

 

@DefaultUrl("http://www.google.com")
public class GooglePage extends PageObject {

@FindBy(name="q")
WebElement search;

@FindBy(name="btnK")
private WebElement searchButton;

public void enterSearch(String keyword) {
search.type(keyword);
}

public void buttonClick() {
searchButton.click();
}

public void searchFor(String keywords) {
search.sendKeys(keywords, Keys.ENTER);
waitFor(titleContains("Google Search"));
}
}

Serenity BDD Automation Framework

Tools required for building a serenity bdd automation framework are as follows:

JDK
IDE – Eclipse, IntelliJ etc.
Build Tool – Maven , Gradle etc.
Libraries – Serenity, JBehave , Selenium WebDriver etc.
Source control – Git , Subversion etc.
Drivers – GeckoDriver , ChromeDriver etc.

Extras:
CI – Jenkins
Cloud providers – SuaceLabs, BrowserStack etc.

 

Links:

Some useful links are listed below:

Automation Environment Setup

Writing Stories

PageObject

 

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 Maven Artifacts

JBehave /

Serenity Maven Artifacts

Introduction to Serenity BDD

JBehave /

Introduction to Serenity BDD

Jbehave Ubuntu

JBehave /

Install JBehave Plugins on Ubuntu

‹ Serenity Maven Artifacts› JBehave + Serenity Sample Project

Recent Posts

  • Antivirus Products for Windows 11 PC
  • Install CodeBlocks IDE on Windows 11
  • Location Privacy Settings on Windows
  • Windows 11 Virus & Threat Protection
  • Download & Install Python on Windows 11
  • Cumulative Update for Windows 11 Version
  • Test execution speed in Selenium IDE
  • Check Windows 11 Free Upgrade
  • Download IntelliJ IDE on Windows 11
  • New MySQL Connection in Workbench

Back to Top

Automation Tutorials

  • JBehave Tutorial
  • Selenium Tutorial
  • TestNG Tutorial
  • JUnit Tutorial

Links

  • Contact
  • Privacy Policy
  • Cookie Policy

www.TestingDocs.com

Go to mobile version