What is BDD 2.0 (SDD)?

May 15, 2021

In this article we will discuss a software testing technique. (For information on the mental disorder, see Body Dysmorphic Disorder.)

BDD stands for Behavior-Driven Development and it was an attempt to express end-to-end tests from an end user's perspective. The idea was to allow users to write specifications in Gherkin Language which looked like this:

Scenario: Eric wants to withdraw money from his bank account at an ATM
    Given Eric has a valid Credit or Debit card
    And his account balance is $100
    When he inserts his card
    And withdraws $45
    Then the ATM should return $45
    And his account balance is $55

Why?

Once a scenario is created, a QA Engineer would write code (usually in Selenium) to implement the specification in code before the actual implementation was ready.

The advantages of that were supposed to be that...

  1. ...business users built the specification of how the application was supposed to work before it was implemented;
  2. ...once it was implemented, it was supposed to double down as a regression test ensuring that the functionality still functioned as expected.

Issues

As great of an idea as it seemed, there were several problems with it:

  1. Specification was useless until the code (Selenium or similar) was written;
  2. Gherkin Language was hard to understand for business users;
  3. It added additional overhead and need to maintain additional, tightly coupled with code piece of specifications;
  4. The maintenance would suffer from all the issues of the underlying implementation (Selenium et. al), namely the reliance on the HTML/XML structure of the page/screen as opposed to end-user's point of view;
  5. It was almost impossible to write the implementation of the Gherkin specification until actual feature was released because the implementation of Gherkin would rely on XPaths.

Overall the most implementations of BDD failed because it failed to deliver enough value to justify the additional overhead.

BDD 2.0 (SDD)

BDD 2.0, or Specification-Driven Development (SDD) is designed to solve those issues. Specifically:

  1. A subset of a free-flowing plain English commands is used to allow business users to describe the steps from the end-user's perspective;
  2. No reliance on HTML/XML structure what so ever, everything is expressed from the end-user's perspective;
  3. Specification is literally executable out of the box, allowing to avoid the step of writing code like Selenium in Java or Python.

What does BDD 2.0 (SDD) look like?

It looks like this:

click "Register"
generate by regex "[a-z0-9]{30}\@testrigor-mail\.com", then enter into "Email" and save as "newEmail"
enter "password123" into "Password"
click "Sign Up"
check that email to saved value "newEmail" was delivered
check that page contains button "Confirm Registration"
click "Confirm Registration"
check that page contains text "Successfully confirmed"

Each instruction is executable out of the box. Also, SDD allows for modularity allowing to assign a sequence of steps any arbitrary name like checkout a product.

This enabled actual business users to write actual executable specifications in exactly the domain-specific language they use themselves.

Currently, the only known implementation of SDD is testRigor.

Great! You've successfully subscribed.
Great! Next, complete checkout for full access.
Welcome back! You've successfully signed in.
Success! Your account is fully activated, you now have access to all content.