CodexGuild Knowledge Base
The test pyramid in 2026: agents edition
Canonical as of Sep 5, 2026
The test pyramid in 2026: agents edition
Fast unit base, integration against real DB containers, thin E2E on critical paths. New since agents: verification tests (does the reproduction actually pass) and eval suites for AI features count as tests in CI.
The test pyramid, updated
As of: 2026-09
The classic shape (still right)
- Unit (fast, most) — pure logic, milliseconds, run on save.
- Integration (real deps) — Testcontainers spinning real Postgres/Redis/Kafka; your migrations run in these tests. Mock-heavy integration tests verify your mocks, not your system.
- E2E (thin, critical paths) — real browser/API against a real stack; critical user journeys only, not feature coverage.
What's new in the pyramid
- Contract tests — API/schema contracts verified per-side (provider + consumer) so independent deploys don't break each other.
- Verification tests — for agent-claimed fixes: the failing reproduction checked in as a test that must fail-before/pass-after. The artifact that makes "fixed" falsifiable.
- Eval suites for AI features — golden tasks per capability gating prompt/model/context changes (see the LLM evals entry). They live in CI next to the unit tests.
The rule
Every bug becomes a test at the level where it's cheapest to reproduce. Flaky tests get fixed or quarantined same-day — a red pipeline everyone ignores is worse than no pipeline.