# Phase 7 Testing

> Phase 7 — Test Strategy with pyramid, coverage gates, load tests, and Critical User Journeys

- Skill: `exchanet/phase-7-testing` (Agent Skill)
- Install (CLI): `npx skillmds@latest add exchanet/phase-7-testing`
- Raw SKILL.md: https://api.skillmd.com/api/skills/exchanet/phase-7-testing/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- Author: exchanet (https://skillmd.com/u/exchanet)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/exchanet/phase-7-testing

---


# Skill: Phase 7 — Test Strategy

## Purpose

Define the complete enterprise test strategy: test pyramid allocation, coverage requirements (≥99%), Critical User Journeys, load test scenarios, and CI/CD quality gates.

## When to use

- Phase 7 of the full 8-phase cycle
- Before writing any implementation code (TDD approach)
- When configuring CI/CD pipelines
- When defining SLO validation tests

## Test Pyramid Template

```markdown
## Test Pyramid: [System/Feature Name]

| Layer | Target % of tests | Coverage requirement | Blocking |
|---|---|---|---|
| Unit | 70% | ≥99% line + branch coverage | YES |
| Integration | 20% | 100% integration points | YES |
| E2E | 7% | 100% critical user journeys | YES |
| Chaos/Load | 3% | All SLO scenarios validated | YES |

### Test toolchain
Unit: [Vitest / Jest / pytest / go test]
Integration: [Supertest + Testcontainers / pytest + docker-compose]
E2E: [Playwright / Cypress]
Load: [k6 / Artillery / Locust]
Coverage: [c8 / Istanbul / coverage.py]
```

> **Coverage floor vs quality ceiling:** ≥99% line/branch coverage is required as a minimum, but coverage alone does not equal test quality. Always verify that assertions check meaningful behavior — if introducing a bug in the covered code would not cause a test to fail, the test is not providing value regardless of coverage numbers.

## Critical User Journeys (CUJ)

List the 5-10 most important user flows that MUST work end-to-end:

| ID | Journey | Pass criteria |
|---|---|---|
| CUJ-001 | [User action end-to-end] | [Observable outcome] |
| CUJ-002 | [Error scenario] | [Graceful degradation] |

## Load Test Scenarios

Define 3 scenarios minimum:

| Scenario | Duration | TPS | p95 SLO | Error SLO |
|---|---|---|---|---|
| Baseline | 30 min | [steady TPS] | ≤ [ms] | < [%] |
| Spike | 2 min | [peak TPS] | ≤ [ms] | < [%] |
| Soak | 8 hours | [sustained TPS] | ≤ [ms] | < [%] |

## CI/CD Quality Gates

Recommend using the templates in `.ci-cd/templates/`:

```bash
# Copy GitHub Actions workflow to your project
cp .ci-cd/templates/github-actions/workflow-enterprise-builder.yml \
   .github/workflows/enterprise-builder.yml
```

Gates implemented:
- Gate 1: Enterprise context document exists
- Gate 3: No unmitigated critical risks
- Gate 5: All ADRs validated
- Gate 7: Coverage ≥99% + all tests pass
- Gate 8: Delivery artifacts complete

## Validation

After generating the test strategy document, optionally validate coverage configuration:

```bash
# Run coverage check (requires coverage-summary.json generated by your tests)
bash .ci-cd/scripts/coverage-check.sh --threshold=99
```

## Output artifact

Save as part of the Phase 7 section in the planning document, or as `docs/test-strategy.md`.

