testing-strategy
Skill1 starsChanged 2 months agoMITView on GitHub
Language-agnostic framework for designing, structuring, and evaluating automated test suites. Triggers whenever an agent is asked to "write tests for this", "what should I test?", "is this well tested?", "how much test coverage do I need?", "this test is flaky", or when debating unit vs integration vs e2e tests. Enforces the test pyramid, behavior-driven testing over implementation details, strict mocking discipline, root-cause resolution for flaky tests, and using coverage as a risk signal rather than a vanity metric.
37 other projects use a version of this.
Adopted by
Most recently taken up by
- HMBSbige/skillstheir own version, first seen Oct 3, 2026
- vospr/context-engineering-templatetheir own version, first seen Oct 1, 2026
- lgzarturo/codeconductortheir own version, first seen Sep 30, 2026
- Cure-Consulting-Group/ProductEngineeringSkillstheir own version, first seen Sep 28, 2026
- komluk/scaffoldingtheir own version, first seen Sep 28, 2026
- BGLuis/skillstheir own version, first seen Sep 15, 2026
Used with
Projects with it also use react-patterns, observability and 9 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.
benshapyroSkillreact-patterns
Modern React patterns for TypeScript applications including hooks, state management, and component composition. Use when building React components, managing state, or implementing React best practices.
Also in 4 projects that use this
OpenAISkillobservability
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 AzureSkillgit-workflow
Squad branching model: dev-first workflow with insiders preview channel
Also in 6 projects that use this
MicrosoftSkillerror-handling
统一错误处理系统。在添加 API 端点、修改错误处理、添加前端 API 调用、编写错误相关测试时使用。
Also in 3 projects that use this
CloudAI-XSkilldatabase-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
OpenAISkillverification-before-completion
Use when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always
Also in 6 projects that use this
- +4 more from openai
Other versions37 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 37
- anthropics/knowledge-work-plugins★ 26ksame name
- irahardianto/awesome-agv★ 157same name
- AnastasiyaW/codex-claude-code-config★ 153same name
- zakariaf/Flutter-Skills★ 52same name
- shinpr/agentic-code★ 49same name
- addxai/enterprise-harness-engineering★ 44same name
- drafthq/draft★ 40same name
- Hack23/European-Parliament-MCP-Server★ 28same name
- suhailkakar/the-skills★ 26same name
- komluk/scaffolding★ 15same name
27 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository13 other files it gives its agents.
- accessibility-auditSkill
- agent-skills-authoringSkill
- api-designSkill
- ci-cd-pipelineSkill
- code-reviewSkill
- design-system-adapterSkill
- docker-and-containersSkill
- docs-and-adrSkill
- git-commit-workflowSkill
- package-security-vettingSkill
- secrets-and-config-managementSkill
- ui-cloneSkill
- universal-coding-standardsSkill
The file
We split this skill into the rules it gives an agent
6 rules. 0 are common, 5 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 33 edited versions we read keep these.
5
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
- Distinctive: line 49
Dependencies: Use lightweight real dependencies (Testcontainers, in-memory SQLite, local test servers).
- Distinctive: line 57
Thin Glue / API Gateways: When an application is primarily a router/orchestrator with almost no internal algorithmic logic, unit tests add …
- Distinctive: line 69
Test public inputs and outputs, not private methods or internal state variables.
- Distinctive: line 70
The Refactoring Test: If you rewrite the internal implementation without changing the public contract, your tests should still pass.
- Distinctive: line 87
If a test requires 30 lines of mock configuration to test 3 lines of business code, stop.
- Very specific: line 101
Order Dependence: Test B passes only if Test A ran first.
“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.
Files
Testing Strategy & Architecture
A language-agnostic operational standard for deciding what to test, how much to test, and at which layer of the test pyramid.
Sibling Standards:
- For general test writing guidelines, see
universal-coding-standards.- For evaluating test adequacy during code review, see
code-review.
1. Test Pyramid & Level Selection
Select the right test level based on execution cost and isolation needs:
▲
/ \ E2E Tests (~5-10%)
/ \ Full user-journey through real UI/stack. Slow, expensive, high-confidence.
/-----\
/ \ Integration Tests (~20-30%)
/ \ Verify 2+ real components interacting (Real DB, API contracts).
/-----------\
/ \ Unit Tests (~60-70%)
/_______________\ Isolated functions, math, pure logic, fast in-memory execution.Level Definitions:
- Unit Tests:
- Scope: Verifies a single isolated function, class, or domain entity.
- Dependencies: Mock out external slow boundaries (network, filesystem, time).
- Speed: Milliseconds. Can run thousands on every file save.
- Integration Tests:
- Scope: Verifies the real interaction between two or more components (e.g., repository layer against a real test database, serialization over HTTP).
- Dependencies: Use lightweight real dependencies (Testcontainers, in-memory SQLite, local test servers).
- Speed: Seconds. Run on git pre-push or PR validation.
- End-to-End (E2E) Tests:
- Scope: Simulates a complete user workflow through the full system (e.g., signup $\rightarrow$ checkout $\rightarrow$ invoice generation).
- Dependencies: Real running services.
- Speed: Minutes. Reserve strictly for mission-critical core paths.
When to Invert the Pyramid Deliberately:
- Thin Glue / API Gateways: When an application is primarily a router/orchestrator with almost no internal algorithmic logic, unit tests add little value. Shift weight toward integration tests verifying real payload contracts.
- UI-Heavy Frontends: Core component interactions are often best validated through component integration tests (e.g. React Testing Library) rather than purely isolated unit tests.
2. What to Test (The Quality Standard)
- 2.1 New Logic Always Gets a Test: Never excuse missing tests with "it's simple" or "it's just a helper". Bugs live in the simple things.
- 2.2 Dual Coverage (Happy Path + Boundary Case): Every unit of business logic must test:
- The primary successful outcome (happy path).
- At least one boundary, empty, or error condition (edge case: null input, negative value, timeout, unauthorized state).
- 2.3 Test Behavior, Not Implementation Details:
- Test public inputs and outputs, not private methods or internal state variables.
- The Refactoring Test: If you rewrite the internal implementation without changing the public contract, your tests should still pass. If they break, you were testing implementation details.
- 2.4 Don't Test the Framework: Never write tests verifying that language/framework primitives work (e.g., testing that a plain getter returns what a setter stored, or that a library's array sorting sorts).
3. Mocking Discipline & Anti-Patterns
Mocking is a necessary tool, but over-mocking destroys test confidence.
- 3.1 What to Mock:
- External I/O (Stripe, Twilio, third-party HTTP APIs).
- Non-deterministic factors (current system time, random UUIDs, crypto salt).
- Slow / dangerous resources (disk formatters, email sending).
- 3.2 What NOT to Mock:
- Internal business collaborators or adjacent helper classes. Let them run real code.
- Language data structures (don't mock a
MaporList).
- 3.3 The "Over-Mocking" Smell:
- If a test requires 30 lines of mock configuration to test 3 lines of business code, stop. You are testing your mock configuration, not production behavior.
- 3.4 Prefer Fakes Over Canned Mocks:
- Where practical, use lightweight stateful fakes (e.g., an in-memory repository implementing the interface) over rigid canned mocks (
when(repo.get(1)).thenReturn(...)).
- Where practical, use lightweight stateful fakes (e.g., an in-memory repository implementing the interface) over rigid canned mocks (
4. Diagnosing & Eliminating Flaky Tests
A flaky test is a high-priority bug in your test suite, never an acceptable nuisance. Never re-run a failing test in CI until it turns green without investigating.
Top 4 Causes of Test Flakiness:
- Shared Mutable State: Tests polluting a shared database, global variables, or singleton caches. Fix by isolating test contexts or truncating state in
beforeEach/teardown. - Unmocked Time & Race Conditions: Relying on real wall-clock delays (
sleep(500)). Fix by using deterministic fake timers (vi.useFakeTimers(),time-machine). - Async Polling / Missing Awaits: Code finishes after the test framework has already asserted. Fix by explicitly awaiting promises or polling conditions with a timeout.
- Order Dependence: Test B passes only if Test A ran first. Verify test suite independence by shuffling execution order (e.g.,
pytest --random-order,jest --randomize).
Quarantine Policy: If a flaky test cannot be fixed immediately, quarantine it with a skipped annotation (e.g.
@pytest.mark.skip) and must link to an open tracking issue. Never delete tests silently.
5. Coverage as a Signal, Not a Target
- 5.1 Coverage % is a Vanity Metric: 95% line coverage with weak or missing assertions provides false confidence.
- 5.2 Prioritize Risk Over Percentages:
- Critical paths (Authentication, Payment processing, State machines, Data integrity) require rigorous branch coverage.
- Trivial boilerplate (DTOs, simple config maps, generated code) does not need coverage.
- 5.3 Ban Tautological Tests: Reject tests written solely to hit coverage numbers without asserting meaningful behavioral outcomes (e.g. calling a function without an
assertorexpect).
6. Test Design & Structure
- Scenario-Descriptive Naming: Name tests after the scenario and expected outcome:
- ✅
returns_validation_error_when_email_lacks_at_symbol - ❌
test_emailortest_error
- ✅
- AAA Pattern (Arrange, Act, Assert): Visually separate test execution into three clear blocks:
// Arrange const cart = new ShoppingCart(); cart.add(item, 2); // Act const total = cart.calculateTotal(); // Assert expect(total).toBe(40.0); - Independent Execution: Every test must be completely isolated and capable of running in parallel or random order.
Detailed References
references/framework-notes.md: Canonical test idioms, parameterized tables, and mocking examples across pytest (Python), Vitest / Jest (JS/TS), Go testing, JUnit 5 (Java), cargo test (Rust), and PHP / Laravel (Pest & PHPUnit).
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
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.

