Write BDD scenarios in Gherkin format (Given/When/Then) in pure business language. Use when creating acceptance tests, user story scenarios, or stakeholder-readable specifications.
Limited to specific tools
Additional assets for this skill
This skill is limited to using the following tools:
Skill Type: Actuator (BDD Workflow) Purpose: Write behavior scenarios in Gherkin format (Given/When/Then) Prerequisites:
You are in the SCENARIO phase of BDD (SCENARIO → STEP DEFINITIONS → IMPLEMENT → REFACTOR).
Your goal is to write scenarios in pure business language using Given/When/Then format.
Critical: Use NO technical jargon. Business stakeholders should understand every word.
Parse the requirement:
Example:
<REQ-ID>: User login with email and password
Business Rules:
- BR-001: Email must be valid format
- BR-002: Password minimum 12 characters
- BR-003: Max 3 login attempts, 15min lockout
Acceptance Criteria:
- User can log in with valid credentials
- User sees error with invalid email
- User account locks after 3 failed attempts
Create scenarios for:
Example scenarios for <REQ-ID>:
Scenario 1: Successful login (happy path)
Scenario 2: Login fails with invalid email (BR-001)
Scenario 3: Login fails with short password (BR-002)
Scenario 4: Account locks after 3 failed attempts (BR-003)
Scenario 5: User can login after lockout expires
Follow BDD framework conventions:
Cucumber (JavaScript/TypeScript/Java):
features/authentication.feature
features/payments/credit-card.feature
features/admin/user-management.feature
Behave (Python):
features/authentication.feature
features/payments/credit_card.feature
features/admin/user_management.feature
If unsure: Use features/<domain>/<feature-name>.feature
Template:
# features/authentication.feature
# Validates: <REQ-ID>
# Business Rules: BR-001, BR-002, BR-003
Feature: User Login
As a registered user
I want to log in with my email and password
So that I can access my account
Background:
Given the application is running
And I am on the login page
Scenario: Successful login with valid credentials
# Validates: <REQ-ID> (happy path)
Given I am a registered user with email "user@example.com"
And my password is "SecurePassword123!"
When I enter email "user@example.com"
And I enter password "SecurePassword123!"
And I click the "Login" button
Then I should see "Welcome back"
And I should be redirected to the dashboard
Scenario: Login fails with invalid email format
# Validates: BR-001 (email validation)
Given I am on the login page
When I enter email "invalid-email"
And I enter password "SecurePassword123!"
And I click the "Login" button
Then I should see "Invalid email format"
And I should remain on the login page
Scenario: Login fails with password too short
# Validates: BR-002 (password minimum length)
Given I am on the login page
When I enter email "user@example.com"
And I enter password "short"
And I click the "Login" button
Then I should see "Password must be at least 12 characters"
And I should remain on the login page
Scenario: Account locks after three failed login attempts
# Validates: BR-003 (account lockout)
Given I am a registered user with email "user@example.com"
And my password is "CorrectPassword123!"
When I attempt to login with email "user@example.com" and password "WrongPassword1!"
And I attempt to login with email "user@example.com" and password "WrongPassword2!"
And I attempt to login with email "user@example.com" and password "WrongPassword3!"
Then my account should be locked
When I attempt to login with email "user@example.com" and password "CorrectPassword123!"
Then I should see "Account locked. Try again in 15 minutes"
Scenario: User can login after lockout expires
# Validates: BR-003 (lockout expiry)
Given I am a registered user with email "user@example.com"
And my account was locked 16 minutes ago
When I enter email "user@example.com"
And I enter password "CorrectPassword123!"
And I click the "Login" button
Then I should see "Welcome back"
And my account should be unlocked
Key elements:
# Validates: <REQ-ID>Check each scenario:
❌ Technical Language (Avoid):
When I POST to "/api/auth/login" endpoint
Then HTTP status code should be 200
And JWT token should be in response header
✅ Business Language (Use):
When I enter my credentials and submit
Then I should see "Welcome back"
And I should be logged into my account
Rule: If a stakeholder can't understand it, rewrite it.
Run BDD framework:
# Cucumber (JavaScript)
npm run cucumber
# Behave (Python)
behave features/authentication.feature
# Cucumber (Java)
mvn test -Dcucumber.options="features/authentication.feature"
Expected output:
Feature: User Login
Scenario: Successful login with valid credentials # UNDEFINED
Scenario: Login fails with invalid email format # UNDEFINED
Scenario: Login fails with password too short # UNDEFINED
Scenario: Account locks after three failed attempts # UNDEFINED
4 scenarios (4 undefined)
You can implement step definitions for undefined steps with these snippets:
@given('I am a registered user with email {email}')
def step_impl(context, email):
raise NotImplementedError()
✅ This is GOOD! Scenarios undefined because step definitions don't exist yet.
Create commit:
git add features/authentication.feature
git commit -m "SCENARIO: Add scenarios for <REQ-ID>
Write BDD scenarios for user login functionality in business language.
Scenarios cover:
- Successful login (happy path)
- BR-001: Email validation
- BR-002: Password minimum length
- BR-003: Account lockout after 3 attempts
- BR-003: Lockout expiry
Scenarios: 5 scenarios (all undefined as expected - SCENARIO phase)
Validates: <REQ-ID>
"
When you complete the SCENARIO phase, show:
[SCENARIO Phase - <REQ-ID>]
Requirement: User login with email and password
Scenarios Created:
✓ Successful login (happy path)
✓ Login fails with invalid email (BR-001)
✓ Login fails with short password (BR-002)
✓ Account locks after 3 failed attempts (BR-003)
✓ User can login after lockout expires (BR-003)
Feature File: features/authentication.feature (5 scenarios, 67 lines)
Business Language Check:
✓ No technical jargon ✓
✓ Stakeholder-readable ✓
✓ User story format ✓
Running scenarios...
Scenario: Successful login UNDEFINED
Scenario: Login fails invalid email UNDEFINED
Scenario: Login fails short password UNDEFINED
Scenario: Account locks after 3 fails UNDEFINED
Scenario: Login after lockout expires UNDEFINED
Result: 5 scenarios UNDEFINED ✓ (expected - SCENARIO phase)
Commit: SCENARIO: Add scenarios for <REQ-ID>
✅ SCENARIO Phase Complete!
Next: Invoke implement-step-definitions skill
Before invoking this skill, ensure:
If prerequisites not met:
requirement-extraction skillAfter SCENARIO phase completes:
implement-step-definitions skill to create step definitions✅ Declarative (What, not How):
When I log in with valid credentials
Then I should see my dashboard
❌ Imperative (Too detailed):
When I type "user@example.com" in the email field
And I type "password123" in the password field
And I move my mouse to the login button
And I click the login button
Then I should see a div with class "dashboard"
✅ Reusable:
Given I am logged in as "user@example.com"
❌ Too specific:
Given there is a user "user@example.com" with password "pass123" in the database
And I navigate to "/login"
And I enter "user@example.com" in "#email-input"
And I enter "pass123" in "#password-input"
And I click "#login-button"
Use Background for common preconditions:
Background:
Given I am on the login page
Scenario: ...
# Don't repeat "Given I am on the login page"
Why business language?
Gherkin keywords:
Feature: High-level capabilityBackground: Common preconditionsScenario: Specific test caseGiven: Preconditions (setup)When: Actions (what user does)Then: Expected outcomes (assertions)And/But: Continue previous keywordHomeostasis Goal:
desired_state:
scenarios_in_business_language: true
scenarios_cover_all_business_rules: true
stakeholder_readable: true
"Excellence or nothing" 🔥