madappgang/claude-code/testing-strategies
Claude Code and agent skill by madappgang/claude-code
- community
- ext:[{"type":"hook","description":"Pre/post lifecycle hooks"}]
Checking that the SKILL.md file is still in the repository.
Use when writing tests, setting up test frameworks, implementing mocking strategies, or establishing testing best practices (unit, integration, E2E) across any technology stack.
Install
npx vskill@latest install madappgang/claude-code/testing-strategiesSemi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard
SKILL.md
Universal Testing Strategies
Overview
Language-agnostic testing patterns and strategies applicable across all technology stacks.
Testing Pyramid
Unit Tests (70-80%)
- Test individual functions/methods in isolation
- Mock external dependencies
- Fast execution (< 10ms per test)
- High volume, run on every save
Integration Tests (15-20%)
- Test component interactions
- Real database/API calls (often with test containers)
- Medium speed (100ms - 1s per test)
- Run on commit/PR
End-to-End Tests (5-10%)
- Test complete user flows
- Real browser/environment
- Slow (seconds to minutes)
- Run before deployment
Test Structure: AAA Pattern
Naming Conventions
Test File Names
Test Case Names
Use descriptive names that explain the scenario:
BDD Style (Given-When-Then)
Mocking Strategies
Test Doubles Overview
| Type | Purpose | Example | |
|---|---|---|---|
| Stub | Returns predetermined values | stub.returns(42) | |
| Mock | Verifies interactions | expect(mock).toHaveBeenCalled() | |
| Spy | Wraps real implementation | spy(realFunction) | |
| Fake | Working implementation (simplified) | In-memory database | |
| Dummy | Placeholder (not used) | Required parameter |
When to Mock
DO Mock:
- External services (APIs, databases)
- Time-dependent functions
- Random number generators
- File system operations
- Network requests
DON'T Mock:
- The code under test
- Simple value objects
- Pure functions with no side effects
Mock Example
Test Data Management
Test Factories
Create reusable factory functions for test data:
Fixtures
Static test data for consistent testing:
Assertion Best Practices
Be Specific
One Logical Assertion Per Test
Custom Matchers
Create domain-specific matchers for readability:
Edge Cases to Test
Input Validation
- Empty/null/undefined inputs
- Boundary values (0, -1, MAX_INT)
- Invalid types
- Malformed data
State Transitions
- Initial state
- After single operation
- After multiple operations
- After error and recovery
Async Operations
- Successful completion
- Timeout
- Network errors
- Concurrent operations
- Race conditions
Error Handling
- Expected errors (validation)
- Unexpected errors (system)
- Error recovery
- Error propagation
Code Coverage Guidelines
Coverage Targets
| Type | Target | Notes | |
|---|---|---|---|
| Line Coverage | 80% | Minimum acceptable | |
| Branch Coverage | 75% | Test all conditionals | |
| Function Coverage | 90% | All public APIs | |
| Critical Paths | 100% | Auth, payments, data integrity |
Coverage Pitfalls
High coverage ≠ good tests
Focus on:
- Business-critical paths
- Edge cases and error handling
- Integration points
Test Performance
Keep Tests Fast
| Test Type | Target Time | |
|---|---|---|
| Unit test | < 10ms | |
| Integration test | < 1s | |
| E2E test | < 30s | |
| Full suite | < 5min |
Parallelization
Test Isolation
Tests should not depend on each other:
CI/CD Integration
Pre-commit
- Lint checks
- Type checks
- Unit tests (fast)
Pull Request
- Full unit test suite
- Integration tests
- Coverage report
Pre-deployment
- E2E tests
- Performance tests
- Security scans
Test Maintenance
Avoid Flaky Tests
- Don't depend on timing
- Don't depend on external services
- Use deterministic data
- Retry with care (hide real issues)
Keep Tests Readable
- Clear naming
- Minimal setup
- Obvious assertions
- Helpful failure messages
Review Test Code
- Test code is production code
- Apply same quality standards
- Refactor when needed
Testing strategies applicable to all technology stacks
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingplugins/dev/skills/core/testing-strategies/SKILL.md
Popularity
- Repository stars
- 249
- Repository forks
- 29
- 7-day trend score
- 28
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 3 Apr 2026, 7 months ago.
Extension points
hookPre/post lifecycle hooks
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/madappgang/claude-code/testing-strategies)