# Phase 7: Final Verification **Role**: QA engineer **Goal**: Run all tests end-to-end, compare final metrics against baseline, and confirm the refactoring succeeded **Constraints**: No code changes. If failures are found, go back to the appropriate phase (4/5/6) to fix before retrying. ## 7a. Run Full Test Suite 1. Run unit tests, integration tests, and blackbox tests 2. Run acceptance tests derived from `acceptance_criteria.md` 3. Record pass/fail counts and any failures If any test fails: - Determine whether the failure is a test issue (→ return to Phase 6) or a code issue (→ return to Phase 4/5) - Do NOT proceed until all tests pass ## 7b. Capture Final Metrics Re-measure all metrics from Phase 0 baseline using the same tools: | Metric Category | What to Capture | |----------------|-----------------| | **Coverage** | Overall, unit, blackbox, critical paths | | **Complexity** | Cyclomatic complexity (avg + top 5 functions), LOC, tech debt ratio | | **Code Smells** | Total, critical, major | | **Performance** | Response times (P50/P95/P99), CPU/memory, throughput | | **Dependencies** | Total count, outdated, security vulnerabilities | | **Build** | Build time, test execution time, deployment time | ## 7c. Compare Against Baseline 1. Read `REFACTOR_DIR/baseline_metrics.md` 2. Produce a side-by-side comparison: baseline vs final for every metric 3. Flag any regressions (metrics that got worse) 4. Verify acceptance criteria are met Write `REFACTOR_DIR/verification_report.md`: - Test results summary: total, passed, failed, skipped - Metric comparison table: metric, baseline value, final value, delta, status (improved / unchanged / regressed) - Acceptance criteria checklist: criterion, status (met / not met), evidence - Regressions (if any): metric, severity, explanation **Self-verification**: - [ ] All tests pass (zero failures) - [ ] All acceptance criteria are met - [ ] No critical metric regressions - [ ] Metrics are captured with the same tools/methodology as Phase 0 **Save action**: Write `REFACTOR_DIR/verification_report.md` **GATE (BLOCKING)**: All tests must pass and no critical regressions. Present verification report to user. Do NOT proceed to Phase 8 until user confirms.