liveBook · Manning

Serenity BDD

As explained in BDD in Action, Second Edition

Serenity BDD is a test automation and reporting framework that supports behavior-driven development specifications.

Serenity BDD is an open-source framework for organizing and reporting BDD test results. It supports executable specifications, UI automation, and delivery evidence connected to product-backlog items. section 3.5.1 section 16.3

Serenity BDD contributes practical support across the automation workflow:

  • Creates a Maven project from a Serenity Cucumber Starter template and produces test reports. section 3.5.1
  • Simplifies Page Objects by managing WebDriver lifecycle, instantiating page fields, and extending WebDriver interactions. section 11.3.10
  • Links features, rules, and examples to JIRA issues through the @Issue tag and report integration. section 16.3

A Serenity page object

A LoginPage extends PageObject, declares WebElementFacade fields, and uses type() to enter credentials before clicking the login button. Step definitions can open the page and call signinWithCredentials without explicitly creating the page object. section 11.3.10

@DefaultUrl("/login")                               #1
public class LoginPage extends PageObject {         #2
    @FindBy(id="email")
    WebElementFacade email;                         #3
    
    @FindBy(id="password")
    WebElementFacade password;
    
    @FindBy(id="login-button")
    WebElementFacade loginButton;
 
    public void signinWithCredentials(String emailValue, 
                                      String passwordValue) {
        email.type(emailValue);                     #4
        password.type(passwordValue);               #4
        loginButton.click();
    }
}

Shows the annotated LoginPage implementation and its concise authentication method. section 11.3.10

How BDD in Action, Second Edition covers it

How deep it goes
Explains project setup, reporting, WebDriver conveniences, Page Objects, and issue linkage without detailing framework internals.
Examples
Uses a train-timetables starter project, a LoginPage, credential sign-in steps, and @Issue-tagged authentication scenarios.
What it assumes
Assumes Java, Maven, and optionally GitHub, while applying existing Cucumber, WebDriver, and Page Object practices.
What you can do after
Build it from scratch with a Serenity Cucumber template, automate Page Objects, run Maven verification, and trace tests to JIRA issues.
How it connects
Connects BDD with Cucumber, Maven, WebDriver, Page Objects, living documentation, product backlogs, and JIRA.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of BDD in Action, Second Edition. The section links point to the parts of the book it draws on.