Skip to content

shinpr/claude-code-workflows / dev-skills/skills/testing-principles

testing-principles

Verified

Language-agnostic testing principles for choosing which tests a change needs, test quality, and proof ownership, including frontend and browser E2E tests. Use when writing tests, deciding test scope, or reviewing test quality.

FileKindSize
SKILL.mdskill md5.7 KB
references/e2e.mdmarkdown3.0 KB
references/frontend.mdmarkdown2.5 KB

references/e2e.md

View on GitHub
# E2E Test Implementation

## Browser Harness Resolution

Inspect the repository's browser-test configuration, scripts, fixtures, neighboring tests, and CI routing. Preserve the existing harness, imports, locator conventions, setup lifecycle, file naming, and test location.

When no browser harness exists, establish one only when a test skeleton, the task's Operation Verification Methods, or an accepted requirement names browser-level proof, selecting the lowest-surface sufficient harness from repository and applicable external evidence; otherwise prove the behavior at the cheaper observable boundary. Report an unavailable execution environment as a proof limitation rather than a user decision.

## Lane Selection

- `fixture-e2e`: run a real browser against deterministic fixture or intercepted backend behavior.
- `service-integration-e2e`: run against the required local services or stubs when correctness depends on persistence, transactions, or cross-service contracts.

Preserve the lane selected by the skeleton. A lane change requires evidence that the original lane cannot prove the accepted behavior.

## Structure and Reuse

- Follow the repository's existing browser abstraction and paths.
- Introduce a page object when one interaction is reused across 3+ tests or a coherent workflow would otherwise be duplicated. Keep direct accessible locators for a small, local test.

## Fixture Lane

Use the repository's existing route interception or fixture-loader boundary. Fixtures are deterministic, local to the test or suite, and shaped like the real contract. The browser still exercises the actual UI, navigation, and state updates.

## Service Lane Prerequisites

Before implementation or execution, identify:

- service start and health-check commands;
- test-safe database or data target;
- deterministic seed and cleanup mechanism;
- authentication setup;
- required environment variables and external stubs.

Use the repository's existing seed and authentication mechanisms. Create per-test data with unique identifiers and clean it through the supported API, database fixture, or teardown path. When a required prerequisite is unavailable and adding it is outside approved scope, return the missing prerequisite instead of substituting fixture behavior.

## Locator and Assertion Rules

- Follow the repository's locator convention; otherwise prefer accessible role/name or label locators, then stable test IDs when no semantic locator exists.
- Assert user-observable state, navigation, accessibility, or persisted behavior named by the skeleton. Treat assertions tied only to CSS classes or internal DOM structure as insufficient proof.
- When the UI specification defines responsive behavior, run the affected interaction at the specified viewport; otherwise use the repository's default browser matrix.

## Skeleton Annotations

Preserve the skeleton's annotations unchanged, except `Selection evidence`, which served test selection only and is removed when the test becomes executable. When `Verification items:` are present, implement and assert every listed item.
finishing-a-development-branchobra/superpowersUse when implementation is complete, all tests pass, and you need to decide how to integrate the workStars: 319kUpdated Claude CodeCodexVerifiedInstall
systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixesStars: 319kUpdated Claude CodeCodexVerifiedInstall
test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation codeStars: 319kUpdated Claude CodeCodexVerifiedInstall
skill-creatoranthropics/skillsCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.Stars: 196kUpdated Claude CodeCodexVerifiedInstall