|
| 1 | +# Generate Executable BDD Scenarios from Gap Report |
| 2 | + |
| 3 | +Read the BDD coverage gap report and generate executable feature files + step definition skeletons for the top priority gaps. |
| 4 | + |
| 5 | +**Argument**: Number of gaps to generate for (default: 3). Pass as `$ARGUMENTS`. |
| 6 | + |
| 7 | +## Steps |
| 8 | + |
| 9 | +1. Read the gap report: |
| 10 | +``` |
| 11 | +orchestrator/e2e/reports/coverage-gap-report.json |
| 12 | +``` |
| 13 | + |
| 14 | +If the report doesn't exist, run the scanner first: |
| 15 | +```bash |
| 16 | +cd orchestrator/e2e && npx tsx scripts/scan-coverage.ts |
| 17 | +``` |
| 18 | + |
| 19 | +2. For the top N gaps (from `prioritizedGaps`, where N = `$ARGUMENTS` or 3): |
| 20 | + |
| 21 | +### a. Read Source Genesis Features |
| 22 | +For each gap, find the genesis feature files that match the gap's domain + governance layer: |
| 23 | +``` |
| 24 | +genesis/docs/content/elohim-protocol/{domain}/{user_type}/scenarios/{governance_layer}.feature |
| 25 | +``` |
| 26 | + |
| 27 | +Read these files to understand the conceptual scenarios. |
| 28 | + |
| 29 | +### b. Read Existing Executable Features as Style Reference |
| 30 | +Read these files to match the executable style: |
| 31 | +- `orchestrator/e2e/features/federation/cross-doorway-content.feature` — feature file pattern |
| 32 | +- `orchestrator/e2e/steps/federation.steps.ts` — step definition pattern |
| 33 | + |
| 34 | +### c. Generate Feature Files |
| 35 | +Create `.feature` files at the `suggestedFeatureFile` path from the gap report. |
| 36 | + |
| 37 | +**Translation strategy**: conceptual scenarios describe human experiences. Executable scenarios test the API contracts that would support those flows. For example: |
| 38 | +- "Workers implement community meal program" -> test content creation + tagging + cross-doorway discovery |
| 39 | +- "Workers welcome community stakeholder input" -> test content creation + governance metadata + search |
| 40 | + |
| 41 | +Each generated feature should: |
| 42 | +- Use `@e2e @{epic}` tags on the first line |
| 43 | +- Include a Background with doorway health checks |
| 44 | +- Translate 3-5 conceptual scenarios into executable ones |
| 45 | +- Use Given/When/Then with the existing step patterns (human registration, content creation, content discovery) |
| 46 | +- Add `@wip` tag to scenarios that need step definitions not yet implemented |
| 47 | + |
| 48 | +### d. Generate Step Definition Skeletons |
| 49 | +Create skeleton step files at `orchestrator/e2e/steps/{epic}.steps.ts`. |
| 50 | + |
| 51 | +Each skeleton should: |
| 52 | +- Import from `@cucumber/cucumber` (Given, When, Then) |
| 53 | +- Import `E2EWorld`, `Human`, `BrowserDevice` from the framework |
| 54 | +- Include stub step definitions matching the new feature file |
| 55 | +- Mark incomplete steps with `// TODO: implement` comments |
| 56 | +- Follow the pattern from `federation.steps.ts` |
| 57 | + |
| 58 | +### e. Verify |
| 59 | +For each generated file: |
| 60 | +- Ensure the feature file parses (no syntax errors) |
| 61 | +- Ensure the step file compiles (typecheck) |
| 62 | + |
| 63 | +3. Report what was generated: |
| 64 | +- List of new feature files with scenario counts |
| 65 | +- List of new step definition files |
| 66 | +- Which steps are fully implemented vs TODO |
| 67 | +- Updated coverage estimate (run scanner again) |
0 commit comments