Write Unit Tests Prompt Template
Generate thorough unit test suites covering happy paths, edge cases, and error scenarios. Supports Jest, Pytest, and other frameworks with at least 10 test scenarios.
The Prompt
Make it specific to you
PromptITIN asks a few questions and builds a version tailored to your use case.
How to use this template
Copy the template
Click the copy button to grab the full prompt text.
Fill in the placeholders
Replace anything in [BRACKETS] with your specific details.
Paste into any AI tool
Works with ChatGPT, Claude, Gemini, Cursor, and more.
Or enhance with AI
Sign in to PromptITIN and let AI tailor the prompt to your exact situation in seconds.
Why this prompt works
Requiring test names to read as specifications transforms tests from verification tools into documentation. The contract comment above each test forces intentional design rather than coverage-metric-chasing.
Tips for best results
- Paste the function signature AND a description of the intended behaviour separately — the AI will catch discrepancies between them
- Add 'include tests that document what the function explicitly does NOT do' to RULES — these are the tests that catch scope creep later
- Run the generated tests immediately and fix any that fail due to import paths or syntax before trusting the logic
- Ask the AI to generate a failing test first (TDD style) when designing a new function — it forces clearer specification