Skill

e2e-test-strategy

Plan an end-to-end test pyramid: which flows to E2E, which to integration, which to unit. Seeding strategy, auth state handling, flake mitigation, parallel execution. Use when designing test coverage for a web app or API.

Category
core
Version
0.1.0
License
MIT
Status
active
Length
109 lines
Source
skills/core/e2e-test-strategy/SKILL.md

Install and discovery

npx --yes --package @youcisla/agent-foundry agent-foundry-install

After the installer runs, this record is available as e2e-test-strategy. See the docs for harness roots and verification steps.

Contents

E2E Test Strategy

A test pyramid that catches the bugs that matter, runs fast, and doesn't flake.

Procedure

The Pyramid

       ╱  E2E  ╲              few — 5-20 critical flows
      ╱─────────╲
     ╱Integration╲           some — key API + DB combinations
    ╱─────────────╲
   ╱     Unit     ╲         many — every function, every branch
  ╱─────────────────╲

Don't invert it. Lots of E2E = slow, flaky, low-signal.

Decision Tree

For any test case, ask in order:

  1. Can I test it with a pure function? → Unit
  2. Can I test it with one module + mocked deps? → Integration
  3. Does it span network / browser / external service? → E2E
BehaviorLayer
validateEmail(s) rejects bad inputUnit
UserRepo.create() inserts and returnsIntegration
POST /signup returns 201 + sends emailE2E
Drag-drop reorders listE2E
Pricing tier changes entitlementIntegration
Stripe webhook triggers subscriptionE2E

Which E2E Flows Matter

E2E is expensive. Pick the 5-20 flows where a regression would cost the most.

Always E2ENever E2E
Sign-up → first value momentInternal helpers
Core monetization (checkout, subscription)Pure UI styling
Critical auth (login, password reset)Bulk data imports
Cross-service contracts (webhooks)Background jobs
Critical admin actions

Rule: "What is the user-visible failure cost if this regresses?" Catastrophic → E2E. Cosmetic → unit or skip.

Test Data: Seeding

Bad: production DB or saved dumps.

Good: deterministic per-test seeding.

async function seedUser(opts: { plan?: 'free' | 'pro' } = {}) {
  const id = `test-${randomUUID()}`;
  await db.users.insert({ id, email: `${id}@test.com`, plan: opts.plan ?? 'free' });
  return id;
}

Rules:

  • Each test seeds only what it needs
  • Cleanup in afterEach, not afterAll
  • Unique IDs per run (parallel-safe)
  • Pin time-relative data to fixtures

Anti-patterns

  • Putting every flow in E2E because it is end-to-end.
  • Sharing one seeded user across parallel tests.
  • Relying on production data or saved dumps.
  • A test that passes only when run alone.

References

  • details

Verification Checklist

  • [ ] Each behavior sits at the cheapest layer that can catch it.
  • [ ] E2E set is limited to costly regressions.
  • [ ] Tests seed deterministic, unique data.
  • [ ] Auth state is created without manual steps.
  • [ ] The suite passes in parallel and in isolation.

Test Integrity Rules

  • Snapshot byte-exact prompt assembly for a real skill, the fallback, and a schema-augmented request. A one-space template change must fail.
  • Probe provider capability once and mark skips explicitly; a missing provider is a skip, not a silent pass.
  • Install a raising stub in mocked-provider tests so an accidental real call fails loudly.
  • Reset module caches and env overrides before each test; a spec that passes only alone is a test defect.
  • Verify the world, not the self-report: re-read the file, row, or response. Assert untouched files are byte-identical.
  • A guard only guards if the regression fails it. Introduce the regression once, watch red, revert.