Skip to main content

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:

  1. Document existing behaviors (Reverse Engineering)
  2. Verify that logic remains correct during refactoring
  3. 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:

PhaseMust Cover
CreationSuccess + Validation errors
UpdatesModify fields, Rename, Conflict checks
DeletionCascade, Referential integrity
StatesAll 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

ResourceLocation
Feature Template.agent/skills/specification_extraction/templates/feature_template.gherkin
Mapping Template.agent/skills/specification_extraction/templates/mapping_template.md
Gold Standarddocs/architecture/specs/draft/OrderFee/OrderFeeLineLifecycle.feature