Skip to content

BDR: 4-Layer Architecture

BDR scales by separating responsibility into four distinct layers. This structure ensures that changes in technical implementation (Layer 0) do not break business logic (Layer 2) or test scenarios (Layer 3).

What are we testing?
This layer contains the test scenarios themselves. It uses high-level, human-readable commands. It contains ZERO technical details (no selectors, URLs, or API frameworks).

SCENARIO "User buys a backpack"
ACTOR "Customer"
GIVEN Customer.isLoggedIn()
DO Customer.login()
DO Customer.addItemToCart("Backpack")
DO Customer.checkout()
VERIFY Customer.hasPurchased("Backpack")

How does the business describe this action?
This layer maps high-level intents to orchestrated flows. It represents the “Ubiquitous Language” of the business.

ACTION Customer.addItemToCart(name)
STEP "Customer adds {name} to the cart"
FLOW Inventory.selectItem(name)
FLOW Cart.confirmAddition()

How do we interact with parts of the system?
This layer contains reusable atomic actions. It is the bridge between the domain and the technical implementation.

FLOW Cart.confirmAddition()
STEP "Press Add to Cart button"
UI CartPage.addButton.click()
UI CartPage.cartBadge.waitForIncrease()

Which tool are we using?
A native wrapper for your test tool (Playwright, Selenium, Cypress). This is the ONLY place where tool-specific code lives.

UI Component.click()
STEP "Perform native click"
NATIVE tool.click(this.selector)

  • Reduced Maintenance Costs: If a CSS selector changes, you only update Layer 0 or 1.
  • Improved Readability: Layer 3 reads like a manual test script.
  • Stack Agnostic: You can replace Playwright with Selenium by rewriting only Layer 0.

To maintain consistency across languages (Java, Python, TS), BDR uses these standard terms in pseudocode and documentation:

KeywordDescription
SCENARIOStarts a test scenario (Layer 3).
ACTORDefines the entity performing actions (User, Admin).
GIVENOptional setup condition (pre-condition).
DOExecutes a high-level business action.
VERIFYAsserts a condition.
ACTIONDefines a domain-level behavior (Layer 2).
STEPMarks a block for reporting (Allure step).
FLOWCalls an atomic interaction (Layer 1).
UIPoints to the UI technical layer.
APIPoints to the API technical layer.
DBPoints to the database layer.
NATIVEDirect call to the underlying tool (Playwright/Selenium).