Behavior-Driven Development Enforcement
CRITICAL: When implementing features or user-facing behavior, follow BDD principles.
Discovery â Development â Delivery
1. DISCOVERY: Understand Requirements
- Collaborate with stakeholders (Three Amigos)
- Use concrete examples to clarify requirements
- Document examples as scenarios in Gherkin
- Build shared understanding before coding
2. DEVELOPMENT: Implement with Examples
- Write failing scenario (acceptance test) first
- Implement using outside-in TDD
- Use scenarios as specifications
- Keep scenarios executable and up-to-date
3. DELIVERY: Validate Behavior
- Run scenarios to verify behavior
- Ensure living documentation stays current
- Validate against real business requirements
- Confirm value delivery to stakeholders
When BDD Applies
â ALWAYS use BDD for:
- User-facing features
- Business rule implementation
- Integration scenarios
- API contracts
- End-to-end workflows
- Cross-team collaboration needs
â Skip BDD for:
- Internal utility functions (use TDD)
- Performance optimizations
- Infrastructure code
- Developer tools
Gherkin Scenario Structure
Feature: [Feature name]
[Feature description]
Scenario: [Scenario name]
Given [context/precondition]
When [action/event]
Then [expected outcome]
Outside-In Development
- Write failing scenario (acceptance test at feature level)
- Write failing unit test (for layer you're implementing)
- Write minimum code to make unit test pass
- Refactor
- Repeat until scenario passes
Scenario (Fails) â Unit Test (Fails) â Code â Unit Test (Passes) â Scenario (Passes)
Critical Rules
- Start with examples - Don't code until you have concrete examples
- Use ubiquitous language - Business terms, not technical jargon
- Focus on behavior - What the system does, not how it does it
- Collaborate early - Involve business, dev, and QA in discovery
- Keep scenarios maintainable - Clear, focused, and easy to update
- Scenarios are living documentation - Keep them current
Three Amigos Questions
Before implementing, consider:
- Business: What value does this provide? What are the business rules?
- Development: What are technical constraints? What are edge cases?
- Testing: What could go wrong? How do we verify this works?
Verification Checklist
Before considering a feature complete:
- [ ] Wrote scenarios based on concrete examples
- [ ] Validated scenarios with stakeholders
- [ ] Implemented using outside-in TDD
- [ ] All scenarios pass
- [ ] Scenarios serve as living documentation
Remember: Start with conversation and examples, not code!