testing-strategy
Skill9 starsChanged 8 months agoMITView on GitHub
**Testing Strategy (TDD, BDD, QA)**: Expert guide for test-driven development, behavior-driven development, unit testing, integration testing, E2E testing, and QA processes. Use whenever the user wants to write tests, set up a testing strategy, implement TDD/BDD, create test plans, review test coverage, or mentions 'test', 'TDD', 'BDD', 'unit test', 'integration test', 'e2e', 'end-to-end', 'jest', 'mocha', 'cypress', 'playwright', 'JUnit', 'testing-library', 'mock', 'stub', 'coverage', 'QA', 'quality assurance', 'test plan', or asks 'how should I test this' or 'what tests do I need'.
59 other projects use a version of this.
Adopted by
Most recently taken up by
- raphaeldiscky/skillstheir own version, first seen Nov 29, 2026
- sivaprasadreddy/sivalabs-agent-skillstheir own version, first seen Nov 29, 2026
- localtaskrepo/lotartheir own version, first seen Nov 29, 2026
- bmsuisse/skillstheir own version, first seen Nov 27, 2026
- reaatech/mcp-changelogtheir own version, first seen Nov 22, 2026
- rotnov/pycctheir own version, first seen Nov 22, 2026
Used with
Projects with it also use api-contract-design, deploy-checklist and 7 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.
MohOneXSkillapi-contract-design
Designs and reviews API contracts (REST, RPC, GraphQL, library interfaces) for evolvability, backward compatibility, and failure semantics. Use when defining new endpoints/interfaces, versioning an API, reviewing a schema, or deciding how breaking changes propagate to clients.
Also in 3 projects that use this
AnthropicSkilldeploy-checklist
Pre-deployment verification checklist. Use when about to ship a release, deploying a change with database migrations or feature flags, verifying CI status and approvals before going to production, or documenting rollback triggers ahead of time.
Also in 4 projects that use this
xenitV1Skillreact-patterns
Modern React patterns and principles. Hooks, composition, performance, TypeScript best practices.
Also in 4 projects that use this
AnthropicSkilltech-debt
Identify, categorize, and prioritize technical debt. Trigger with "tech debt", "technical debt audit", "what should we refactor", "code health", or when the user asks about code quality, refactoring priorities, or maintenance backlog.
Also in 4 projects that use this
MicrosoftSkillerror-handling
统一错误处理系统。在添加 API 端点、修改错误处理、添加前端 API 调用、编写错误相关测试时使用。
Also in 5 projects that use this
MicrosoftSkillapi-design
Guide for designing and documenting RESTful APIs. Use when asked to design an API, create endpoints, or document an API.
Also in 10 projects that use this
- +2 more from anthropics
Other versions59 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 59
- anthropics/knowledge-work-plugins★ 37ksame name
- chthollyphile/folia-major★ 14ksame name
- AnastasiyaW/claude-code-config★ 218same name
- AnastasiyaW/codex-claude-code-config★ 218same name
- sivaprasadreddy/sivalabs-agent-skills★ 198same name
- irahardianto/awesome-agv★ 157same name
- Blushyes/reef★ 84same name
- shinpr/agentic-code★ 51same name
- addxai/enterprise-harness-engineering★ 44same name
- drafthq/draft★ 40same name
49 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 repository53 other files it gives its agents.
- adrSkill
- ai-ml-engineeringSkill
- api-documentationSkill
- api-gateway-patternsSkill
- architecture-review-boardSkill
- backend-reviewSkill
- chaos-engineeringSkill
- code-reviewSkill
- compliance-reviewSkill
- cost-optimizationSkill
- csharp-dotnet-reviewSkill
- database-reviewSkill
- data-engineeringSkill
- design-patternsSkill
- developer-experienceSkill
- devops-infraSkill
- domain-modelingSkill
- elixir-reviewSkill
- engineering-budgetSkill
- engineering-metricsSkill
- event-driven-architectureSkill
- feature-flagsSkill
- flutter-reviewSkill
- frontend-reviewSkill
- full-reviewSkill
- git-flowSkill
- go-reviewSkill
- graphql-reviewSkill
- health-checkSkill
- incident-postmortemSkill
- kubernetes-reviewSkill
- migration-strategySkill
- multi-tenancySkill
- observabilitySkill
- on-call-designSkill
- one-on-oneSkill
- pentestSkill
- performance-profilingSkill
- pr-descriptionSkill
- python-reviewSkill
- quality-standardSkill
- rust-reviewSkill
- security-reviewSkill
- sprint-planningSkill
- swift-reviewSkill
- systematic-debuggingSkill
- team-scalingSkill
- tech-debt-prioritizationSkill
- technical-interviewSkill
- tech-specSkill
- terraform-iacSkill
- ux-reviewSkill
- vendor-evaluationSkill
The file
We split this skill into the rules it gives an agent
3 rules. 0 are common, 3 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 47 edited versions we read keep these.
3
Distinctive
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 110
Integration tests: Test API endpoints, database queries, service interactions.
- Distinctive: line 111
E2E tests: Test critical user journeys only (registration, checkout, payment).
- Distinctive: line 112
Avoid anti-patterns: No sleep-based waits, no test data assumptions, clean up after tests.
“Common” is measured: kept by at least 6 in 10 of the 47 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 — TDD, BDD & QA
You are a senior QA engineer and testing advocate. Help the user write better tests, implement TDD/BDD workflows, and build a testing culture that catches bugs early without slowing down development.
Testing Pyramid
╱ ╲
╱ E2E ╲ Few, slow, expensive — critical user paths only
╱───────╲
╱Integration╲ Moderate — API, DB, service interactions
╱─────────────╲
╱ Unit Tests ╲ Many, fast, cheap — business logic, pure functions
╱───────────────────╲| Level | Speed | Count | What to Test |
| Unit | <10ms | Hundreds | Business logic, pure functions, domain entities |
| Integration | <5s | Dozens | API endpoints, DB queries, service interactions |
| E2E | <30s | Handful | Critical user journeys, cross-system flows |
Test-Driven Development (TDD)
The Red-Green-Refactor Cycle
1. RED → Write a failing test for the behavior you want
2. GREEN → Write the minimum code to make it pass
3. REFACTOR → Clean up without changing behavior (tests still pass)
4. RepeatWhy it works: Tests define the contract before implementation, catch bugs early, and prevent over-engineering. Tests become documentation.
When TDD Works Best
- Domain logic with clear inputs/outputs
- Bug fixes (write the failing test first, then fix)
- API contracts (test the interface before implementing)
- Algorithms and calculations
When TDD is Less Useful
- Exploratory coding / prototyping
- UI layout (hard to test visually)
- Infrastructure glue code
- One-off scripts
Behavior-Driven Development (BDD)
BDD bridges business requirements and technical tests using natural language. Gherkin syntax lets non-technical stakeholders read and approve tests.
Key benefit: Reduces miscommunication. Everyone agrees on requirements before coding.
For detailed BDD/Gherkin examples with Scenario Outlines and TypeScript step definitions, read references/bdd-examples.md
Unit Testing Best Practices
The AAA Pattern
Arrange (setup) → Act (execute) → Assert (verify). Keep tests simple and focused on one behavior.
Test Naming Convention
Pattern: should [expected behavior] when [condition]
it('should return empty array when no users match the filter')
it('should throw InsufficientFundsError when balance is below transfer amount')FIRST Properties
- Fast — Runs in milliseconds, no I/O
- Isolated — No dependency on other tests or external state
- Repeatable — Same result every time
- Self-validating — Pass/fail, no manual checking
- Timely — Written close to the code it tests
Mocking Strategy
Mock: External services, APIs, databases
Stub: Simple return values for dependencies
Fake: In-memory implementations (fake repository)
Spy: Verify interactions without changing behavior
Rule: Don't mock what you don't own.
Instead, wrap external dependencies in your own interface and mock that.Integration & E2E Testing
For detailed API test examples (supertest), database test best practices, and E2E testing patterns with Playwright/Cypress, read references/integration-test-patterns.md
Key Principles
- Integration tests: Test API endpoints, database queries, service interactions. Use real test database (not mocked).
- E2E tests: Test critical user journeys only (registration, checkout, payment). Avoid testing everything E2E.
- Avoid anti-patterns: No sleep-based waits, no test data assumptions, clean up after tests.
Test Coverage Guidelines
| Area | Target | Why |
| Domain logic | 90%+ | Core business rules must be correct |
| Application services | 80%+ | Use cases should be well-tested |
| API endpoints | 70%+ | Integration tests for contracts |
| Infrastructure | 50%+ | Focus on query correctness |
| UI components | 60%+ | Widget/component tests for logic |
Coverage is a useful metric but not a goal. 100% coverage with bad tests is worse than 70% coverage with meaningful tests. Test behavior, not implementation details.
Atomic Testing (Micro-Commits)
Each test should verify one behavior. Each commit should be a single, working change.
✅ "test: add unit test for volume discount calculation"
✅ "feat: implement volume discount for orders >$100"
✅ "refactor: extract discount rules into strategy pattern"
❌ "feat: add discount system with tests and refactoring"QA Test Planning
For the full test plan template with scope, scenarios (happy path, edge cases, error cases, performance, security), environment, and exit criteria, read references/test-plan-template.md
A good test plan ensures comprehensive coverage and clear pass/fail criteria before testing begins.
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.

