Testing Prompts
Core Testing Principles
Prompt Templates
General Testing Template
SITUATION: Developing tests for [describe component/function] implemented in [language/framework]
CHALLENGE: Create a comprehensive test suite that verifies functionality, handles edge cases, and confirms error scenarios
AUDIENCE: Developers who need to maintain and extend this code
FORMAT:
- Follow [testing framework] conventions and best practices
- Use descriptive test names that explain behavior being tested
- Organize tests logically by functionality
- Include setup and teardown where appropriate
- Implement proper test isolation
FOUNDATIONS:
- Test happy path scenarios thoroughly
- Include edge case testing
- Verify error handling behavior
- Implement appropriate mocking/stubbing
- Add performance considerations where relevant
- Consider security implications in tests
SPECIFIC REQUIREMENTS:
- Achieve at least 90% code coverage
- Include documentation about test approach
- Implement parameterized tests for related scenarios
- Verify all public interfaces and behaviorsUnit Testing Template
Integration Testing Template
API Testing Template
Frontend Testing Template
Testing Paradigm-Specific Prompts
Test-Driven Development (TDD) Prompts
Behavior-Driven Development (BDD) Prompts
Property-Based Testing Prompts
Test Type-Specific Prompts
Performance Testing
Security Testing
Accessibility Testing
Test Mocking and Isolation Prompts
Mock/Stub Implementation
Test Data Generation
Best Practices for Testing Prompts
Request Test Documentation
Specify Coverage Requirements
Request Maintainability Considerations
Evaluating Test Results
Example: Before and After
Before: Basic Test
After: Comprehensive Test Suite
Testing Anti-Patterns to Avoid
Conclusion
Last updated