Stop 04 · SDLC, Agile & Testing MethodologiesTopics · 5/9

Behavior-Driven Development (BDD)

Part of the QA Testing Roadmap

In short

What if the business, developers and testers all wrote down the expected behaviour in the same plain sentences, and those sentences became automated tests? That's BDD.

Writing test scenarios in a structured, plain-language format (Given-When-Then) that both technical and non-technical stakeholders can read and agree on — tools like Cucumber execute these scenarios directly as automated tests.

The purple blob shows a smartphone to a smiling grandmother at a small shop counter.

Think of it like this

Explaining UPI to your nani

You don't explain UPI with code. You say: 'Given you have money in the bank, when you scan the shop's QR and enter your PIN, then the shopkeeper gets paid.' Everyone understands it. BDD writes features exactly that way.

Watch it happen

The Three Amigos meeting

Business
Developer
QA

Coupons at checkout

1/5Business explains the rule: valid coupons take 10% off.

The big ideas

What you need to know

Conversation first

BDD is mainly about agreeing on behaviour with examples. The automation is a bonus.

Gherkin format

Given sets the context, When is the action, Then is the expected outcome.

Executable specs

Tools like Cucumber, SpecFlow or behave run each scenario as an automated test.

Living documentation

Scenarios double as up-to-date docs anyone can read, because failing ones get fixed.

See it in code

Walk through the code

gherkin
1Feature: Apply coupon at checkout2 3  Scenario: Valid coupon reduces the total4    Given my cart total is Rs 10005    When I apply the coupon "SAVE10"6    Then the total should be Rs 9007 8  Scenario: Expired coupon is rejected9    Given my cart total is Rs 100010    When I apply the coupon "OLDFEST"11    Then I should see "This coupon has expired"

1/3A feature groups related scenarios.

Plain-language scenarios that a product manager can read and a tool can run.

Save yourself the pain

Common mistakes

Oops

Writing Gherkin full of UI clicks like 'When I click the button with id btn-7'.

Do this instead

Describe behaviour in business terms. Keep clicks and locators in the step code.

Oops

Using BDD tools without the three-way conversation.

Do this instead

Without business and developers agreeing on examples, it's just extra syntax on normal tests.

Your mission

Write three scenarios

~25 min

Quick check

In 'Given my cart has 2 items, When I remove one, Then my cart shows 1 item', what does the When line describe?

Go deeper

  1. 1Write a BDD scenario in Given-When-Then format for a sample feature.
  2. 2Learn why BDD's plain-language format improves communication between QA, developers, and business stakeholders.
  3. 3Explore a BDD framework (like Cucumber) at a conceptual level.

More topics at this stop

Stuck on this topic? Ask an Insider

Get 1:1 guidance from people who've walked this exact path — on the InsideEdge app.

Download
InsideEdge