Test Generation Prompt

Generate meaningful tests for a function or component.

THE RESOURCE

## 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 resource

1. Copy the resource above and paste it into your AI tool.

2. Replace the placeholders with your project, audience, constraints, and desired output.

3. Review the result against your design goal. Ask for one focused revision at a time.

Related resources

Continue with resources from the same discipline and category.

Browse this category →