TestingDocs.com
    Software Testing website
    • Automation
      • Selenium
      • JBehave Framework
    • Tutorials
      • MySQL Tutorials
      • 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

    • ChatGPT Plans Free and PlusChatGPT Subscription Plans
    • Stellar Converter for Database ToolStellar Converter for Database
    • Stellar MySQL Log AnalyzerStellar Log Analyzer for MySQL
    • Stellar Repair for MySQLStellar Repair for MySQL
    • ChatGPT IntroductionChatGPT Capabilities
    • How to secure your SQL Database: Tips and Tricks
    • ChatGPT4 Conversational AI FeaturesChatGPT4 Conversational AI Features
    • Trends in Software EngineeringShaping the Future of Development: Exploring Key Trends in Software Engineering
    • Java PerformanceImproving Java Performance with Multithreading
    • QDrant Vector DatabaseOpen-source Vector Databases
    • Difference between PHP and JavaScript?
    • Bing AI Browser Web ContentBing Conversation Styles
    • ChatGPT PreviewChatGPT Introduction
    • Open Source AI Frameworks TensorFlowOpen Source AI Frameworks
    • Artificial Intelligence Tools

    Back to Top

    Links

    • Contact
    • Privacy Policy
    • Cookie Policy

    www.TestingDocs.com