Skip to content

Frontend Testing Strategy ​

These rules define framework-neutral test boundaries and behavior expectations. Vue tooling appears as a concrete example. Select runners, coverage thresholds, fixtures, and CI merge gates according to the project's adopted policy.

Decision ​

Tests MUST follow responsibility ownership:

  • Business components MUST have both UI behavior tests (Vue component tests in Vue projects) and component service unit tests.
  • UI components do not require project-level unit tests by default.
  • Stores, services, and composables with meaningful behavior MUST have unit tests.
  • Critical user journeys SHOULD have end-to-end coverage using the project's selected browser test runner.

Test Levels and Tools ​

Test levelBoundaryStandard tools
UnitServices and non-reactive business logicProject's unit runner; Vue example: Vitest
UnitShared stores and stateful behavior modulesProject's unit runner; Vue example: Vitest
Component unitComponent rendering and interactionFramework component utilities; Vue example: Vue Test Utils
End-to-endCritical user journeys through a real applicationProject-selected browser runner; Vue example: Playwright

End-to-end tools do not replace isolated unit or component tests. Vue Test Utils is one implementation for Vue component behavior and lifecycle-scoped reactive modules.

Rules ​

  1. 001-testing-stack-and-tools.md defines how to choose unit and component testing tools; it gives Vue examples.
  2. 002-unit-testing-services.md defines isolated service tests, API doubles, mapping, validation, and errors.
  3. 003-unit-testing-business-components.md defines tests for business-component UI behavior and component services.
  4. 004-ui-components-and-unit-testing.md defines the default exclusion of UI components from project-level unit tests.
  5. 005-unit-testing-stores-and-composables.md defines tests for state owners and reusable reactive behavior; examples use Vue.
  6. 006-playwright-e2e-views.md defines the generic user-journey boundary with a Playwright example.
  7. 007-shared-playwright-fixtures.md is an optional policy for projects that adopt a shared Playwright fixture package.
  8. 008-coverage-and-quality-gates.md is an optional project 80% statement-coverage policy.
  9. 009-testing-practices-and-organization.md defines behavior assertions, test doubles, placement, and maintenance.
  10. 010-e2e-ci-and-pr-protection.md defines an optional every-PR E2E merge gate.

Review Checklist ​

Before merging a frontend change, verify:

  • [ ] Meaningful components, services, state owners, and reusable behavior have focused tests at their public boundaries.
  • [ ] UI components do not receive unnecessary project-level unit-test suites.
  • [ ] Critical user journeys have end-to-end coverage using the project's selected runner.
  • [ ] Unit tests use controlled test doubles for API clients and other external dependencies.
  • [ ] Tests assert behavior, including meaningful failure paths, rather than implementation details.
  • [ ] Apply coverage thresholds and required CI gates only when the project adopts them.

Principle ​

Use the smallest boundary that proves behavior. Vue tools in these documents are examples; project-specific thresholds, fixtures, and merge gates are explicitly identified and are not universal defaults.

You own what ships.