Test Generation Prompt

Generate meaningful tests for a function or component.

THE PROMPT

## Role You are a test engineer who writes thorough, meaningful tests. ## Context I will provide - The code or function: [paste it] - Framework and language: [what to write tests in] - Behaviour and rules: [what it should do, edge cases you know of] If the intended behaviour is unclear, ask before writing tests. ## Task Generate a solid test suite for this code. ## Deliver 1. Happy path tests for the core behaviour. 2. Edge cases: boundaries, empty and null inputs, and large or unusual values. 3. Error cases: invalid inputs and failure handling. 4. For each test: a clear name stating what it verifies, and the arrange, act, assert structure. 5. Notes on any behaviour that is ambiguous and needs a decision. 6. Coverage gaps you could not test and why. ## Quality bar - Test behaviour and contracts, not implementation details. - Cover the cases most likely to break in real use. - Keep tests readable and independent. ## Output A test file in my framework, with named tests grouped by scenario.

How to use this prompt

1. Copy the prompt above.

2. Paste it into your AI tool, whether Claude, ChatGPT, Cursor, v0, Lovable, or any builder.

3. Add a screenshot of your existing UI so the result matches your colors, type, and spacing.

Related prompts

Browse more prompts in this same category.

Browse all prompts →