| name | bdd-format |
| description | BDD test step format standards for QA test case writing and review. Use when writing Given/When/Then test steps, applying 8-space indentation rules, structuring BDD scenarios, or validating BDD format compliance in test case documents. |
| user-invocable | false |
BDD Format Standards
Step Structure (Mandatory Order)
| Step | Role | Rules |
|---|
| GIVEN | Precondition / Setup | Exactly one per test case; describe initial system state |
| WHEN | User Action(s) | One or more; actions only — no validations |
| THEN | Expected Outcome(s) | One or more; verifications only — no further actions |
| AND | Block Extension | Extends WHEN (additional action) or THEN (additional validation) |
Critical: Exact Indentation Rule
Use exactly 8 spaces before every GIVEN/WHEN/THEN/AND keyword. No tabs — ever.
Test Steps :
GIVEN Employee History Export Template feature toggle is ON
AND I am on the Employee History Export Template setup page
WHEN I click on 'Add expression' button
THEN I should see a 'Clear editor' button prominently displayed
AND The button should be enabled and clickable
Step Writing Rules
GIVEN (Precondition)
- Single GIVEN per test case — no exceptions
- Must state feature toggle ON/OFF and system state
- Format:
GIVEN [Feature Toggle Name] feature toggle is [ON/OFF]
- Include user role when access-specific:
AND User is logged in with [Role] role
WHEN (User Actions Only)
- Contains only user-observable actions
- Steps must be atomic and specific
- Approved verbs: clicks, selects, enters, navigates, submits, uploads, clears, toggles
- Forbidden terms: "tries", "tests", "checks", "does something", "attempts to verify"
THEN (Validations Only)
- Contains only expected outcomes — never user actions
- Include exact error messages or UI state descriptions
- Reference specific UI element names as they appear in the application
AND (Continuation)
- Extends WHEN with another user action, OR
- Extends THEN with another expected outcome
- Never mix action AND with validation AND in the same block
Format Validation Checklist
Before finalizing any test case, verify:
Well-Formed Example
Test Steps :
GIVEN Employee History Export feature toggle is ON
AND User is logged in with System Administrator role with Web Access Rights
WHEN User navigates to Employee History Export setup page
AND User clicks on 'Add expression' button
THEN A 'Clear editor' button is displayed prominently on the page
AND The button is enabled and ready for user interaction
AND No error messages are displayed
Common Mistakes to Avoid
| Mistake | Correct |
|---|
GIVEN User clicks login | Move click to WHEN |
THEN User clicks Save | Move click to WHEN |
WHEN The page shows an error | Move to THEN |
| Using tabs instead of 8 spaces | Replace with exactly 8 space characters |
AND after GIVEN (extended precondition) | Acceptable for preconditions only |