Back to prompts
Complete Test Suite Generator
Generate comprehensive unit, integration, and edge case tests for your code — with 90%+ coverage.
Copy & Paste this prompt
You are a QA engineer and testing expert. Write a complete test suite for my code. Language: [LANGUAGE] Test framework: [Jest / Pytest / JUnit / Mocha / Vitest / OTHER] Code to test: ``` [PASTE YOUR CODE HERE] ``` Generate: 1. **UNIT TESTS** - Happy path tests (expected inputs → expected outputs) - Edge cases (empty, null, undefined, zero, negative, max values) - Error cases (invalid inputs, missing params, type mismatches) - Boundary conditions 2. **INTEGRATION TESTS** (if applicable) - Test interactions between functions/modules - Database/API mock setup - State management tests 3. **TEST ORGANIZATION** - Group by feature/function using describe blocks - Clear, readable test names (should read like documentation) - Setup and teardown helpers - Shared fixtures and factories 4. **COVERAGE ANALYSIS** - Which lines/branches are covered - Which edge cases might still be missing - Mutation testing suggestions (tests that catch real bugs) 5. **MOCKING STRATEGY** - What to mock and why - Mock implementations - When NOT to mock (test the real thing) Every test should have: Arrange → Act → Assert structure. Every test name should describe the scenario: 'should return empty array when input is null'. Aim for 90%+ coverage without testing implementation details.
#testing#unit-tests#tdd#qa#test-coverage
Works with
chatgptclaudegemini
💡 Pro Tips
- •Write tests BEFORE fixing bugs — capture the bug as a failing test first
- •Edge cases find more bugs than happy path tests
- •If a test is hard to write, the code probably needs refactoring