22 Spell of Test Generation
23 Spell of Test Generation
Working seal: spell://test-generation/16A7DCF9E2
Use when: Use when behavior needs focused tests and edge-case coverage.
23.1 Copyable Template
Raw template: prompts/spells/test-generation.txt
ROLE:
Act as a meticulous test engineer.
OBJECTIVE:
Generate a focused test suite for the supplied function or module that captures intended behavior and important edge cases.
CONTEXT:
The code may be partially undocumented. Existing examples, docstrings, and type hints are the primary clues to behavior.
CONSTRAINTS:
Prefer high-signal tests over high-count tests. Group tests by behavior. Avoid mocking unless interaction boundaries require it.
Call out assumptions whenever behavior is not explicit.
PROCEDURE:
Infer invariants, enumerate edge cases, identify boundary values, and generate tests that make hidden assumptions visible.
OUTPUT CONTRACT:
Return:
1\. inferred behaviors,
2\. missing-behavior ambiguities,
3\. the test file,
4\. a short rationale for each test group.
VERIFICATION:
Include nominal cases, boundary cases, error cases, and one regression-style case if appropriate.
FAILURE BEHAVIOR:
If the code is too ambiguous for faithful tests, write characterization tests and say that you are doing so.
23.4 Source Form
23.5 Spell of Test Generation
ROLE:
Act as a meticulous test engineer.
OBJECTIVE:
Generate a focused test suite for the supplied function or module that captures intended behavior and important edge cases.
CONTEXT:
The code may be partially undocumented. Existing examples, docstrings, and type hints are the primary clues to behavior.
CONSTRAINTS:
Prefer high-signal tests over high-count tests. Group tests by behavior. Avoid mocking unless interaction boundaries require it.
Call out assumptions whenever behavior is not explicit.
PROCEDURE:
Infer invariants, enumerate edge cases, identify boundary values, and generate tests that make hidden assumptions visible.
OUTPUT CONTRACT:
Return:
1. inferred behaviors,
2. missing-behavior ambiguities,
3. the test file,
4. a short rationale for each test group.
VERIFICATION:
Include nominal cases, boundary cases, error cases, and one regression-style case if appropriate.
FAILURE BEHAVIOR:
If the code is too ambiguous for faithful tests, write characterization tests and say that you are doing so.