Write and maintain Behavior-Driven Development tests with Gherkin and Cucumber. Use when defining acceptance scenarios, writing feature files, implementing step definitions, running Three Amigos sessions, or diagnosing BDD test quality issues. Keywords: bdd, gherkin, cucumber, given when then, feature files, step definitions, acceptance criteria, three amigos, example mapping.
Does it follow best practices?
Evaluation — 96%
↑ 1.04xAgent success when using this tile
Validation for skill structure
A structured workshop technique using colored cards to explore features through rules and examples. Helps teams quickly identify what they know, what they don't know, and what needs clarification.
| Color | Represents | Purpose |
|---|---|---|
| Yellow | User Story / Feature | The capability being built |
| Blue | Rules | Business rules and acceptance criteria |
| Green | Examples | Concrete scenarios illustrating rules |
| Red | Questions | Uncertainties that need answering |
Time-boxed: 25-30 minutes maximum Participants: Business, Development, Testing (Three Amigos) Materials: Colored index cards or sticky notes
1. Start with the Story (Yellow Card)
┌─────────────────────────────────────┐
│ As a customer │
│ I want to apply discount codes │
│ So that I can save money on orders │
└─────────────────────────────────────┘2. Identify Rules (Blue Cards)
┌─────────────────────────────────┐
│ Discount codes are case- │
│ insensitive │
└─────────────────────────────────┘
┌─────────────────────────────────┐
│ One discount code per order │
└─────────────────────────────────┘
┌─────────────────────────────────┐
│ Expired codes cannot be applied │
└─────────────────────────────────┘3. Provide Examples (Green Cards)
For each rule, add concrete examples:
Blue Rule: "Discount codes are case-insensitive"
└─ Green: "SAVE20" and "save20" both work
└─ Green: "SaVe20" also works
Blue Rule: "One discount code per order"
└─ Green: Apply "SAVE20" → Works
└─ Green: Then try "FREESHIP" → Rejected
Blue Rule: "Expired codes cannot be applied"
└─ Green: Code expired yesterday → Rejected
└─ Green: Code expires tomorrow → Works4. Capture Questions (Red Cards)
┌─────────────────────────────────┐
│ ? Can codes be combined with │
│ promotional pricing? │
└─────────────────────────────────┘
┌─────────────────────────────────┐
│ ? What happens if item already │
│ discounted by 50%? │
└─────────────────────────────────┘
┌─────────────────────────────────┐
│ ? Who can create discount codes?│
└─────────────────────────────────┘Yellow Card (Story):
As a new visitor
I want to create an account
So that I can make purchasesBlue Cards (Rules):
Green Cards (Examples):
Rule 1: Email must be unique
Rule 2: Password must be strong
Rule 3: Age must be 18+
Rule 4: Email verification required
Red Cards (Questions):
┌────────────────────────────────────────────────────────┐
│ YELLOW: User Registration Story │
├────────────────────────────────────────────────────────┤
│ │
│ BLUE: Email unique BLUE: Password strong │
│ GREEN: new@test.com GREEN: "abc" fails │
│ GREEN: existing fails GREEN: "abc123!" works │
│ │
│ BLUE: Age 18+ BLUE: Email verification │
│ GREEN: 17 rejected GREEN: Click link works │
│ GREEN: 18 accepted GREEN: No click = blocked │
│ │
│ RED: Email change? RED: Link expiry? │
│ RED: Bounced emails? RED: Parent consent? │
└────────────────────────────────────────────────────────┘Stop the session if:
RED RED RED RED RED REDSignal: Not ready to develop. Need more discovery. Action: Schedule follow-up with stakeholders.
BLUE BLUE BLUE BLUE BLUE BLUE BLUESignal: Story too large. Action: Split into multiple stories.
YELLOW
BLUE BLUE BLUE
GREEN GREEN GREEN GREEN GREEN
RED REDSignal: Clear rules, good examples, few questions. Action: Proceed to development.
After the session, convert cards to Gherkin scenarios:
Blue Rule + Green Examples → Gherkin Scenario
Blue: "Password must be strong"
Green: "abc" → Error "Too short"
Green: "abcdefgh1!" → Success
Becomes:
Scenario Outline: Password strength validation
When I register with password "<password>"
Then I should see "<result>"
Examples:
| password | result |
| abc | Too short |
| abcdefgh | Needs number |
| abcdefgh1 | Needs special character |
| abcdefgh1! | Registration successful |Red Questions → Follow-up Tasks
RED: "How long is verification link valid?"
Actions:
- [ ] Ask product owner
- [ ] Document decision
- [ ] Add scenario when answeredGREEN: When POST /api/register with {email, password}
Then return 201 with JWT tokenInstead:
GREEN: Register with valid email → Account createdYELLOW: Complete checkout flow
BLUE: Validate cart
BLUE: Process payment
BLUE: Update inventory
BLUE: Send confirmation
BLUE: Calculate tax
BLUE: Apply shipping
BLUE: Validate address
BLUE: Check fraud rulesToo complex! Split into multiple stories.
GREEN: Valid input → Success
GREEN: Invalid input → ErrorInstead:
GREEN: Register with "alice@example.com" → Success
GREEN: Register with "not-an-email" → Error: "Invalid email format"RED: What about international addresses?
RED: How do we handle gift cards?
RED: Can businesses register?
[Session ends, questions never answered]Don't ignore questions! Assign owners and follow up.
Use virtual whiteboard tools:
Digital colored cards work the same way.
Break into multiple sessions:
Session 1: Story A - Core registration
Session 2: Story B - Email verification
Session 3: Story C - Social loginWhen too many red cards:
┌─────────────────────────┐
│ SPIKE: Research │
│ International address │
│ validation requirements │
└─────────────────────────┘
Questions to answer:
- RED: Which countries?
- RED: Postal code formats?
- RED: Address validation API?Run spike, then reconvene for Example Mapping.
25-30 minutes reveals if story is:
All three perspectives (business, dev, test) align on:
Too many blue cards → Story too big → Split it Too few rules → Story too small → Combine with others
Red cards surface:
1. Example Mapping Session (30 min)
↓
2. Review and Prioritize Examples
↓
3. Write Gherkin Scenarios (from green cards)
↓
4. Implement Step Definitions
↓
5. Develop Feature (TDD)
↓
6. All Scenarios Pass → DoneStory: Password Reset
Session Output:
YELLOW: Password Reset
BLUE: Reset link sent to registered email
GREEN: Request reset for "user@example.com" → Email sent
GREEN: Request reset for "unknown@example.com" → Email sent (security: don't reveal if email exists)
BLUE: Reset link expires after 1 hour
GREEN: Click link after 30 minutes → Works
GREEN: Click link after 90 minutes → Expired error
BLUE: Multiple requests invalidate previous links
GREEN: Request reset twice → First link no longer works
RED: Rate limiting for reset requests?
RED: What if email bounces?
RED: Can user reset password while logged in?Resulting Gherkin:
Feature: Password Reset
Rule: Reset link sent to registered email
Scenario: Request reset with registered email
Given user "alice@example.com" exists
When I request password reset for "alice@example.com"
Then I should receive reset email
And I should see "If email exists, reset link sent"
Scenario: Request reset with unknown email
When I request password reset for "unknown@example.com"
Then I should see "If email exists, reset link sent"
But no email should be sent
Rule: Reset link expires after 1 hour
Scenario: Use reset link within expiry window
Given I requested reset 30 minutes ago
When I click the reset link
Then I should be able to set new password
Scenario: Use reset link after expiry
Given I requested reset 90 minutes ago
When I click the reset link
Then I should see "Reset link expired"
Rule: Multiple requests invalidate previous links
Scenario: Request reset twice
Given I requested reset and received link
When I request another reset
Then the first link should no longer work
And the second link should workFollow-up Tasks:
[ ] Product owner: Define rate limiting rules
[ ] Tech lead: Investigate email bounce handling
[ ] UX: Design in-app password reset flow