BDD & SDD

BDD & SDD

What is BDD?

BDD, which stands for Behavior-Driven Development, is a software development methodology that emphasizes collaboration between developers, QA (Quality Assurance), and non-technical participants in a software project. Its main intent is to allow for the creation of system behavior specifications in a readable, user-friendly format using the Gherkin language.

Example:
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 was BDD created?
BDD was introduced with two primary goals:
  1. Enable business users to outline how the application should operate before its actual development.
  2. Use these specifications as regression tests to ensure continued proper functionality.

Challenges with BDD

  • Specifications: The Gherkin specifications cannot be executed until they are converted into code using tools like Selenium.
  • Complexity for business users: The Gherkin language can be unintuitive and hard for non-technical stakeholders to understand and write.
  • Maintenance overhead: BDD test implementations become tightly bound to the code, leading to maintenance challenges.
  • Dependence on web structures: BDD tests often rely heavily on the controls behind the web page and mobile application structures (HTML/XML) instead of the interface that the end-users see. This can lead to brittle tests since back-end changes occur much more frequently than UI changes, but they are especially brittle when UI changes do occur.
  • Implementation timing: Implementing BDD tests is challenging before the feature is completely developed because it often depends on specific UI back-end elements, like XPaths.

BDD 2.0: Specification-Driven Development (SDD)

SDD, also known as BDD 2.0, is an evolution designed to tackle the challenges posed by traditional BDD.

Key Features of SDD:

  1. User-Friendly Language: It employs a subset of plain English commands, making it accessible for less technical users.
  2. End-User Perspective: It does away with the need to rely on web page structure, emphasizing the user’s perspective instead.
  3. Ready-to-Execute Specifications: SDD specifications are executable immediately, eliminating the need for any coding and the time it takes to build it.
Example of SDD:
insert "Credit Card"
check that page contains "Balance: $100"
click "Withdraw"
enter "45" into "amount"
click "Confirm"
enter "1234" into "PIN"
click "Complete"
check that page contains "Transaction complete"
check that money given by ATM is equal to "45"
click "Ok"
check that page contains "Balance: $55"

Why is SDD a better alternative?

SDD both accomplishes the goals of BDD more comprehensively than BDD does and solves the challenges that BDD creates. It can be summarized in the following three points:

  • Simplicity for business users: The plain English commands in SDD are more intuitive, enabling actual business users to draft executable specifications in a language familiar to them.
  • Less overhead: SDD bypasses the need for coding tests, which can save time and reduce maintenance challenges.
  • End-user focus: Tests are constructed from an end-user’s viewpoint rather than being tied to the underlying code or web page structure.
Conclusion: While BDD aims to bridge the communication gap between technical and non-technical stakeholders in software projects, it comes with its limitations. SDD, as implemented by testRigor, attempts to simplify the process, reduce overheads, and offer reliable tests from an end-user’s perspective.

Test your knowledge

Allows for creating system specifications exclusively for developers
Uses the Gherkin language to prioritize which features to develop
Allows for the creation of system behavior specifications in a human-readable format
Enables business users to code the application themselves
SDD specifications are immediately executable without the need for additional coding
SDD places a greater emphasis on web page structure than BDD does
SDD is less focused on the end-user’s perspective compared to BDD
SDD requires a deep understanding of the Gherkin language