Skip to main content

Testing strategy and quality gates

Eight steps to lock down regressions with vitest, pytest, Playwright, testcontainers, and the repository's manual CI runner, then prove completion and recovery.

Difficulty
Intermediate
Lessons
8

More tests do not equal safer. Absent tests do not equal faster. The real design choice is which layers to emphasise for your project size, team, and cost of an incident.

Who it's for

  • People endlessly stuck on "which test do I write here?"
  • Folks running vitest, pytest, and Playwright in one repo
  • Teams who want the CI green light to actually mean something

What you can do afterwards

  • Apply the test pyramid (80% unit · 15% integration · 5% E2E) in practice
  • Standardise vitest mocks with vi.hoisted
  • Use pytest fixtures and parametrize well
  • Run real PostgreSQL in tests with testcontainers
  • Auto-generate Playwright smoke manifests
  • Use the repository's manual CI runner and service-scoped quality gates
  • Map completion evidence across product, design, engineering, user, and operations
  • Put partial failure, migrations, readiness, and rollback into the quality gate

Flow

Building confidence through verification

Fast feedback

Check small contracts quickly with the test pyramid and language-level unit tests.

Real dependencies

Prove boundary behavior with container-based integration tests and focused E2E checks.

Automated gate

Make CI reproduce the same evidence and stop failures before deployment.

Completion and recovery

Accept completion only after public smoke and recovery exercises pass.

Cost and confidence rise from top to bottom. CI lands last because the gate only makes sense once every layer below is in place.

Steps

  1. Test pyramid · trade-offs — cost vs confidence · picking layers
  2. vitest basics + mock patternsvi.hoisted · vi.stubEnv · node vs jsdom
  3. pytest · fixture · parametrize — conftest · async · coverage
  4. testcontainers — real PostgreSQL containers + idempotent seeding
  5. Playwright E2E — auto manifests · @write PROD skip
  6. Manual CI runner and quality gate — OS wrappers · Node SSOT · artifacts · service scope
  7. Turn completion criteria into verifiable evidence — five perspectives · contracts · usability
  8. Put partial failure and recovery into the quality gate — idempotent seeds · expand/contract migrations · readiness · rollback

Prerequisites — getting-started + any prior test writing experience.

Lessons

  1. 1

    Test pyramid · trade-offs

  2. 2

    vitest basics + mock patterns

  3. 3

    pytest · fixtures · parametrize

  4. 4

    testcontainers

  5. 5

    Playwright E2E

  6. 6

    A manual CI runner and service-scoped quality gates

  7. 7

    Turn completion criteria into verifiable evidence

  8. 8

    Put partial failure and recovery into the quality gate

Other courses

All courses →