Tests & QA21 categories
Find property-based test ideas
Code with a large input space where example tests only scratch it.
Suggest property-based tests for the code below. Look for properties of these kinds: - Invariants that hold for all inputs: length, ordering, sign, membership, conservation of total. - Round trips: encode then decode, serialise then parse, do then undo. - Equivalence: this implementation agrees with a slower obvious one. - Idempotence: applying twice equals applying once. - Commutativity or associativity, where the operation claims it. - Metamorphic relations: how the output must change when the input changes in a known way. For each property: state it in plain language, then as test code, with a suitable generator. Note which inputs the generator must be able to produce for the property to be meaningful, and flag any property you suspect is false for this code. Code:
Making it yours
- Paste your own material where the prompt asks for it. Everything above that line is instruction, not content.
- Delete any rule that does not apply to you. A shorter prompt that fits beats a thorough one that does not.
- If the answer comes back vague, add a line saying what you do not want. Constraints work better than encouragement.
Finding coverage gaps. Working out which behaviours, edge cases and error paths nothing currently checks.
Related prompts
Audit this suite for untested behaviourYou wrote tests and want to know what you did not think of.Write test cases from acceptance criteriaA story is ready for QA and the criteria need turning into concrete checks.Test the error pathsWhen every existing test exercises the happy path.Brainstorm edge cases for this featureBefore writing tests, to widen the input space you are imagining.What is untested here?Code with tests you suspect are not covering much.Fifteen edge cases, list onlyA function you are about to call finished.
Keep this one
Phrasery saves prompts with a right-click and puts them back the same way. Add this to your own library in one click.
Add to your browser โ free