🧪
Test Suite Generator
Generate comprehensive tests for existing code
prompt template
Write a comprehensive test suite for this code:
```
[PASTE_CODE_TO_TEST]
```
**Testing framework:** [jest / vitest / playwright — default to vitest]
Generate tests covering:
1. **Happy path** — normal expected usage (2-3 tests)
2. **Edge cases** — boundary values, empty inputs, large inputs
3. **Error cases** — invalid input, network failures, missing data
4. **Integration points** — mock external dependencies properly
For each test:
- Use descriptive test names that read like documentation ("should return empty array when no items match filter")
- Follow AAA pattern (Arrange, Act, Assert) with clear separation
- Use meaningful variable names (not foo/bar)
- Add a brief comment explaining WHY we test this case if it's not obvious
Also provide:
- Mock setup for any external dependencies
- A beforeEach/afterEach if shared setup is needed
- Total coverage assessment: what's tested, what's not, and why
Keep tests focused — one assertion per test when possible.How to Use This Prompt
- 1Copy the prompt template above
- 2Paste into Claude, ChatGPT, or Cursor
- 3Replace [bracketed placeholders] with your specific project details
- 4Iterate on the AI output to refine and customize the results
More Testing Prompts
Related testing templates from the vault
🧪
API Integration Test Suite
Use this prompt to api integration test suite with AI assistance
Intermediatetestingintegration
🧪
Chaos Engineering Test Generator
PROGenerate chaos engineering experiments to test system resilience under failure conditions
Advancedtestingchaos-engineering
🧪
Snapshot Testing Strategy
Use this prompt to snapshot testing strategy with AI assistance
Beginnertestingsnapshot
🧪
Visual Regression Testing Pipeline
Set up visual regression testing to catch unintended UI changes
Intermediatevisual-testingplaywright
You Might Also Like
Prompts from other categories that share similar tags
🐛
Debugging
Flaky Test Debugger
Diagnose and fix intermittently failing tests
Shared:testing
🚀
DevOpsPRO
GitHub Actions Matrix CI Pipeline
Build a comprehensive GitHub Actions CI pipeline with matrix testing
Shared:testing
🗄️
DatabasePRO
Database Seed Data Generator
Use this prompt to database seed data generator with AI assistance
Shared:testing
Keep Exploring the Vault