--- name: up-test-model-generate description: Generate functional, unit, API/contract, browser-E2E, smoke, and usability test cases for the current iteration's stories, maintain Bruno API collections and a reproducible, tagged regression suite runnable at multiple scopes (project/iteration/UC/FR), compile the 21-sheet Manual QA Excel workbook, and produce the iteration's Manual Testing Guide for QA. Use this after up-iteration-plan has selected the iteration's use-case slice, and before or alongside up-code-generate. Covers Stage 12 (Construction) of the UP-AI v1.0 Process (process/AI_Native_Unified_Process_v1.md). --- # up-test-model-generate — Stage 12 (Construction, per iteration) ## Objective Generate comprehensive multi-path test cases scoped to the current iteration's stories, compiling the 21-sheet Manual QA Excel Workbook (`.xlsx`) and Markdown Guide, maintaining git-versioned Bruno collections, and folding tests into the cumulative regression suite to guarantee ≥95% automated test coverage. ## When to invoke - After `up-iteration-plan` has produced `iteration_backlog.md`. - Can run in parallel with `up-wireframe-spec`. - Also invoke whenever `up-defect-fix` adds a regression test for a fixed defect. ## Read first - `tech-profile.yaml` (identifies test frameworks, coverage thresholds, and sandboxes) - Current iteration's `project_sdlc/05_iteration_planning/iterations/iteration-NN/iteration_backlog.md` (STORY-xxx list) - `project_sdlc/03_requirements/use_cases/uc-xxx_*/functional-reqs.md` (acceptance criteria per FR) - `project_sdlc/07_test_design/regression_test_cases.md` (traceability index of the cumulative regression suite) - `project_sdlc/07_test_design/test_strategy.md` (tagging convention, tool-per-test-type) - Current iteration's `iteration_surface_matrix.md` - Current iteration's `parallel_work_plan.md`, if parallel lanes are planned ## Procedure For every `STORY-xxx` in the current iteration: 1. Derive one or more `TC-xxx` test cases directly from its FR's acceptance criteria. 2. Cover main flow, alternate flows, and exception flows as authored in the owning use case. 3. Add the new `TC-xxx` set to the appropriate `project_sdlc/07_test_design/functional_test_cases/TC-0xx_*.md` file. 4. Fold tests that should run on every future build into `regression_test_cases.md` — tag with originating iteration. 5. Update `test_traceability_matrix.md` so each `TC-xxx` traces back to its `STORY-xxx` → `FR-xxx` → `UC-xxx`. **Per-type applicability:** For every `STORY-xxx`, record an explicit decision for Unit, Smoke, and Usability — `Required` (with derived `TC-xxx`) or `N/A` (with stated reason). **Bruno API collections:** For every API surface touched by the iteration, generate/update a Bruno collection (`.bru`, git-versioned plain text) under `project_code/docs/api/bruno//` in the implementation workspace, derived from OpenAPI specs. **Regression suite index:** Index runnable tests in `regression_test_cases.md` (`TC-xxx | test_level | automation status | physical file path/collection path | tags`). Tag every automated test so `scripts/run_tests.sh` can select it by scope (`--scope project|iteration-NN|uc-xxx|fr-xxx`). **Manual Testing Guide & 21-Sheet Excel Workbook:** For every iteration, Stage 12 MUST produce TWO complementary manual QA deliverables: 1. Markdown walkthrough guide: `project_sdlc/07_test_design/manual_qa/iteration-NN/MANUAL_TESTING_GUIDE.md` (preconditions, steps, disposable personas, expected results). 2. 21-sheet, 30-column Excel Manual QA Workbook: `project_sdlc/07_test_design/manual_qa/workbooks/IterationNN__Complete_Manual_Testcases.xlsx`, compiled deterministically using `scripts/generate_manual_qa_workbook.py`. The workbook MUST be densely populated with **$\ge 20$ concrete test cases** spanning the 16 test categories, and MUST achieve **$\ge 80\%$ semantic alignment** directly targeting this iteration's specific in-scope Use Cases, Stories, and FRs. Copying identical boilerplate test cases across workbooks is strictly prohibited and fails Gate 14.1 with Critical error `G14-014`. Zero-row or empty template workbooks violate the anti-placeholder rule and fail Gate 14.1 with Critical error `G14-007`. **Test Idempotency & Disposable Personas:** Automated browser (Playwright) and API tests MUST enforce test idempotency — tests MUST NOT mutate shared global records. Use disposable personas or isolated database fixtures. **Multi-Path Test Coverage & Density:** Every user story MUST be modeled across four test dimensions: (1) Happy Path, (2) Alternate & Boundary/Edge Cases, (3) Negative & Failure Paths, and (4) FSM Invariant & Concurrency Checks. Target the coverage budgets configured in `tech-profile.yaml` (e.g. **≥95.0%** for domain FSMs, **≥90.0%** for adapters, **≥80.0%** for frontend components + Playwright E2E). **Mechanical Derivation of Negative SoD Boundary Tests (`G14-016`):** The Negative & Failure Paths test dimension MUST be mechanically derived from `project_sdlc/04_architecture_design/security/auth_matrix.yaml`. For every action and route touched by in-scope stories: 1. For every role declared in `forbidden_roles`, author an explicit test case (`TC-SEC-xxx`) asserting HTTP 403 on backend API endpoints and route redirection/guard on frontend navigation. 2. For every invalid FSM state, assert HTTP 400/409 State Transition Invariant rejection. 3. Populate the Security sheet of the Manual QA Excel Workbook with these explicit negative persona tests. Omitting negative boundary SoD test cases fails Gate 14.1 with Critical error `G14-016`. ## Output expected Updated `project_sdlc/07_test_design/functional_test_cases/TC-0xx_*.md`, `regression_test_cases.md`, `test_traceability_matrix.md`, `iteration_surface_matrix.md`; git-versioned Bruno collections in `project_code/docs/api/bruno/`; `MANUAL_TESTING_GUIDE.md` AND densely populated 21-sheet Manual QA Workbook `.xlsx` (≥20 test cases). ## Exit criteria Every story in the iteration has ≥1 test case; every story has an explicit Unit/Smoke/Usability applicability decision; every applicable delivery surface has an appropriate test type; every in-scope web portal/screen has browser-E2E coverage; regression suite index is updated; this iteration's required QA deliverables (Manual Testing Guide AND 21-sheet Manual QA Workbook with ≥20 test cases) exist; Bruno collections exist for all declared APIs; multi-path coverage achieves configured targets. ## Related skills Previous: `up-iteration-plan` (Stage 10). Parallel: `up-wireframe-spec`. Feeds: `up-traceability-gate` (Gate 14.1), `up-code-generate`/`up-defect-fix`.