agentleFS
komlukkomluk/scaffolding/skills/testing-strategy/SKILL.md

testing-strategy

Skill15 starsChanged 2 months agoMITView on GitHub

Test pyramid, coverage targets, and unit/integration/E2E patterns. TRIGGER when: planning tests, writing test code, or reviewing coverage. SKIP: quality-gate scoring of plans (use quality-validation); root-causing a failing test (use systematic-debugging); proving a fix works (use verification-before-completion).

37 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use observability, git-workflow and 5 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • OpenAISkill

    observability

    Vercel Observability expert guidance — Drains (logs, traces, speed insights, web analytics), Web Analytics, Speed Insights, runtime logs, custom events, OpenTelemetry integration, and monitoring dashboards. Use when instrumenting, debugging, or optimizing application performance and user experience on Vercel.

    Also in 5 projects that use this

  • Microsoft AzureSkill

    git-workflow

    Squad branching model: dev-first workflow with insiders preview channel

    Also in 6 projects that use this

  • CloudAI-XSkill

    database-design

    Designs database schemas, indexing strategies, query optimization, and migration patterns for SQL and NoSQL databases. Use when designing tables, optimizing queries, fixing N+1 problems, planning migrations, or when asked about database performance, normalization, ORMs, or data modeling.

    Also in 3 projects that use this

  • OpenAISkill

    writing-plans

    Use when you have a spec or requirements for a multi-step task, before touching code

    Also in 4 projects that use this

  • CloudflareSkill

    receiving-code-review

    Use when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement or blind implementation

    Also in 3 projects that use this

  • +2 more from openai

The file

Show its rules and text

We split this skill into the rules it gives an agent

17 rules. 0 are common, 16 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 33 edited versions we read keep these.

  • 16

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Test one thing per test

    line 69
  2. Distinctive:

    Use test containers or in-memory DB

    line 109
  3. Distinctive:

    Test full request/response cycle

    line 113
  4. Distinctive:

    Test user perspective, not implementation

    line 133
  5. Distinctive:

    Use stable selectors (data-testid)

    line 134
  6. Distinctive:

    Use page object pattern

    line 137
  7. Distinctive:

    Use realistic but fake data

    line 158
  8. Distinctive:

    Never use production data

    line 159
  9. Distinctive:

    Use faker libraries for variety

    line 161
  10. Very specific:

    Test files: {module}_test.py or {module}.test.ts

    line 205
  11. Distinctive:

    Unit tests: - Run on every commit

    line 214
  12. Distinctive:

    Integration tests: - Run on PR/merge

    line 215
  13. Distinctive:

    E2E tests: - Run on deploy to staging

    line 216
  14. Distinctive:

    Write tests before fixing bugs

    line 249
  15. Distinctive:

    Test behavior, not implementation

    line 250
  16. Distinctive:

    Keep tests simple and readable

    line 251
  17. Distinctive:

    Test private methods directly

    line 257

“Common” is measured: kept by at least 6 in 10 of the 33 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Testing Strategy Skill

Purpose

Comprehensive testing guidelines including test pyramid, coverage targets, and test patterns.

Auto-Invoke Triggers

  • Planning test strategy
  • Writing unit/integration tests
  • Reviewing test coverage
  • Setting up test infrastructure

Test Pyramid

        /\
       /  \      E2E Tests (10%)
      /----\     - Critical user flows
     /      \    - Slow, expensive
    /--------\   Integration Tests (20%)
   /          \  - API tests, DB tests
  /------------\ - Medium speed
 /              \ Unit Tests (70%)
/----------------\ - Fast, isolated
                   - Business logic

Distribution Guidelines

TypePercentageFocus
Unit70%Business logic, utilities
Integration20%API, database, services
E2E10%Critical user journeys

Coverage Targets

MetricMinimumTarget
Line coverage70%80%
Branch coverage60%70%
Critical paths90%100%

What to Cover

  • All public methods
  • Business logic
  • Edge cases
  • Error handling
  • Integration points

What NOT to Cover

  • Generated code
  • Simple getters/setters
  • Framework code
  • Third-party libraries

Unit Testing

Principles

  • Test one thing per test
  • Tests should be fast (< 100ms)
  • Tests should be isolated
  • Tests should be deterministic
  • No external dependencies

AAA Pattern

Arrange - Set up test data and mocks
Act     - Execute the method under test
Assert  - Verify the expected outcome

Naming Convention

{Method}_{Scenario}_{ExpectedResult}

CreateUser_ValidData_ReturnsUserId
CreateUser_DuplicateEmail_ThrowsConflict
CalculateTotal_EmptyCart_ReturnsZero

Test Categories

CategoryPurposeExample
Happy pathNormal operationValid user creation
Edge caseBoundary conditionsEmpty input, max length
Error caseFailure scenariosInvalid data, not found

Integration Testing

Scope

  • API endpoints
  • Database operations
  • External service calls
  • Message queues

Best Practices

  • Use test containers or in-memory DB
  • Seed known test data
  • Clean up after each test
  • Mock external services
  • Test full request/response cycle

API Test Checklist

  • Correct status code
  • Response body structure
  • Headers (content-type, auth)
  • Validation errors
  • Authorization rules

E2E Testing

When to Use

  • Critical user journeys
  • Payment flows
  • Authentication flows
  • Multi-step workflows

Best Practices

  • Test user perspective, not implementation
  • Use stable selectors (data-testid)
  • Handle async operations properly
  • Keep tests independent
  • Use page object pattern

Critical Paths to Test

  • User registration/login
  • Main feature workflow
  • Payment/checkout
  • Error recovery flows

Test Data Management

Strategies

StrategyUse Case
FixturesStatic test data
FactoriesDynamic test data
BuildersComplex objects
SeedersDatabase state

Rules

  • Use realistic but fake data
  • Never use production data
  • Reset state between tests
  • Use faker libraries for variety

Mocking Guidelines

When to Mock

  • External services (APIs, databases)
  • Time-dependent operations
  • Random values
  • Expensive operations

When NOT to Mock

  • Simple value objects
  • The code under test
  • Everything (over-mocking)

Mock Types

TypePurpose
StubReturn canned responses
MockVerify interactions
SpyRecord calls, pass through
FakeSimplified implementation

Test Organization

File Structure

tests/
├── unit/
│   ├── services/
│   └── utils/
├── integration/
│   ├── api/
│   └── db/
├── e2e/
├── fixtures/
└── conftest.py / setup.ts

Naming

  • Test files: {module}_test.py or {module}.test.ts
  • Match source structure
  • Group related tests in describe/class

CI/CD Integration

Pipeline Stages

  1. Unit tests - Run on every commit
  2. Integration tests - Run on PR/merge
  3. E2E tests - Run on deploy to staging

Quality Gates

GateRequirement
Unit tests100% pass
Coverage> 70%
Integration100% pass
E2E (critical)100% pass

Performance Testing

Types

TypePurpose
LoadExpected traffic
StressBreaking point
SoakMemory leaks
SpikeSudden traffic

Metrics to Measure

  • Response time (p50, p95, p99)
  • Throughput (requests/second)
  • Error rate
  • Resource usage

Best Practices

DO

  • Write tests before fixing bugs
  • Test behavior, not implementation
  • Keep tests simple and readable
  • Run tests frequently
  • Maintain test code quality
  • Use meaningful assertions

DON'T

  • Test private methods directly
  • Write flaky tests
  • Skip tests temporarily (delete instead)
  • Test external systems
  • Ignore slow tests
  • Copy-paste test code

Test Quality Checklist

  • Tests are fast (< 10s for unit suite)
  • Tests are isolated (no order dependency)
  • Tests are deterministic (no flakiness)
  • Tests are readable (clear intent)
  • Tests cover edge cases
  • Tests verify error handling
  • Mocks are minimal and purposeful
  • CI runs tests automatically

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.