testing-strategy

v2026.09.25

Use when designing test architecture, building API test suites, validating API contracts, setting up component or E2E testing, managing test data, debugging flaky tests, reviewing coverage strategy, or organizing test files. Covers test pyramid, mocking (MSW), frontend (React Testing Library, Playwright), and CI integration.

GitHub
安装命令
npx skhub add srstomp/testing-strategy
Markdown
SKILL.md

Testing Strategy

Comprehensive testing guidance for test architecture, coverage strategy, and test design.

Test Pyramid

LevelSpeedCostConfidenceShare
Unit~1msLowNarrow65-80%
Integration~100msMediumMedium15-25%
Contract~10msLowAPI shapePart of unit
E2E~1s+HighBroad5-10%

Key Principles

  • Test behavior, not implementation — test what code does, not how
  • For behavior changes, write the failing test first and verify it fails for the expected reason
  • Follow the testing pyramid — more unit tests, fewer E2E
  • Use meaningful coverage metrics — branch coverage over line coverage
  • Prevent flaky tests — no arbitrary waits, no test interdependence

When NOT to Use

  • For TDD discipline during implementation — see work-session anti-rationalization reference
  • For security testing — see security-audit skill

Quick Start Checklist

  1. Choose test framework (Vitest recommended for new projects)
  2. Design test folder structure mirroring source
  3. Write unit tests for pure logic and utilities
  4. Add integration tests for API endpoints and data flows
  5. Add contract tests against OpenAPI spec (if applicable)
  6. Add E2E tests for critical user journeys only
  7. Set up CI to run tests on every PR
  8. Before completion claims, run verification-before-completion and cite the fresh command result

What NOT to Test

  • Framework internals (React rendering, Express routing)
  • Third-party library behavior
  • Trivial getters/setters with no logic
  • Implementation details (private methods, internal state)

References

ReferenceDescription
test-architecture-structure.mdProject structures, shared utilities, test configuration
test-architecture-isolation.mdPlaywright config, database isolation, performance optimization
test-design-techniques.mdEquivalence partitioning, boundary values, decision tables, state transitions
test-design-error-and-advanced.mdError handling tests, property-based testing, parameterization, regression
frontend-react-testing.mdReact Testing Library, queries, user events, hooks, forms
frontend-vue-a11y-visual.mdVue Test Utils, accessibility, visual/Storybook testing, anti-patterns
e2e-playwright.mdPlaywright POM, fixtures, auth state, API mocking, visual comparison
e2e-cypress-and-stability.mdCypress patterns, flaky test prevention, test data, debugging
mocking-fundamentals.mdMock decision tree, stubs/mocks/spies/fakes, MSW setup and usage
mocking-modules-and-patterns.mdModule mocking, time mocking, anti-patterns, dependency injection
coverage-guide.mdCoverage metrics, meaningful thresholds, CI integration
api-test-frameworks-setup.mdVitest and Jest setup, configuration, running tests
api-test-supertest-and-helpers.mdSupertest usage, request helpers, custom matchers, snapshots, debugging
api-integration-patterns.mdCRUD endpoint tests, relationship tests
api-auth-patterns.mdLogin/logout, protected routes, authorization, auth helpers
api-e2e-and-edge-cases.mdMulti-step workflow tests, error responses, edge cases
api-test-data-factories.mdFactory patterns, builders, fixtures
api-test-data-database.mdDatabase helpers, cleanup strategies, data generation
api-contract-openapi.mdOpenAPI/AJV schema validation, contract tests
api-contract-zod-advanced.mdZod validation, response shape testing, breaking change detection
api-test-ci-pipelines.mdCI pipeline strategy, GitHub Actions, parallel execution
api-test-ci-environments.mdEnvironment config, test reporting, database services, E2E environments
anti-rationalization.mdIron Law, common rationalizations, red flag STOP list for TDD discipline

Runtime Notes

  • Claude Code: dispatch yokay-test-runner via the Task tool with subagent_type: "pokayokay:yokay-test-runner".
  • Codex: there is no subagent dispatch. Execute the agent's role inline — read the corresponding agents/yokay-<name>.md and follow its Behavioral Defaults, Critical Rules, and Output Contract directly in the current session.
发现
标签

此技能尚未发布标签。

版本
最新版本元数据

版本

v2026.09.25

发布时间

2026年9月25日

分类

未分类

许可证

MIT

源路径

plugins/pokayokay/skills/testing-strategy

默认分支

master

最新提交

ef6a34d

Tree SHA

7e3eba3