Strategy: Gherkin & Automated Testing (Living Documentation)
This document provides a high-level overview of Gherkin documentation for WepNG. For detailed extraction templates and best practices, refer to the Specification Extraction Skill.
[!TIP] Detailed Instructions: See Specification Extraction Skill for templates, examples, and step-by-step guidance.
1. Context & Goal
As we prepare to migrate WepNG_MVC to a Headless Architecture, we face a critical challenge: Preserving Business Logic. Much of the logic is currently locked inside "Fat Controllers" or tightly coupled Services.
The Goal: Use Gherkin (Given-When-Then) to:
- Document existing behaviors (Reverse Engineering)
- Verify that logic remains correct during refactoring
- Facilitate communication between Tech and Business
2. The Documentation First Workflow
Do not write code until the behavior is documented and approved.
3. Complete Lifecycle Coverage
When documenting a feature, demand Completeness:
| Phase | Must Cover |
|---|---|
| Creation | Success + Validation errors |
| Updates | Modify fields, Rename, Conflict checks |
| Deletion | Cascade, Referential integrity |
| States | All valid transitions + invalid paths |
4. Discovery Strategy
A. Endpoint Audit
Any Controller method NOT Index, Create, Edit, or Delete is a candidate for specific scenarios.
B. Side-Effect Scan
Look for logic that triggers side effects:
- Calls after
db.SaveChanges() - External services (Email, Invoice, Cache)
- Implicit state modifications
5. Templates & Examples
| Resource | Location |
|---|---|
| Feature Template | .agent/skills/specification_extraction/templates/feature_template.gherkin |
| Mapping Template | .agent/skills/specification_extraction/templates/mapping_template.md |
| Gold Standard | docs/architecture/specs/draft/OrderFee/OrderFeeLineLifecycle.feature |
Related Resources
- Skill: Specification Extraction
- Best Practices: Gherkin Best Practices
- BR Strategy: Business Rules Strategy