Give a function, get runnable unit tests
Recipe template · not yet tested on this site
This page is a recipe template, not yet tested here. Run logs, tokens and time go in after re-testing; until then no estimated numbers are filled in.
When to use
You wrote a function and want tests but don't want to hand-write cases, especially boundaries and error branches.
Preparation
- Host version
- To fill (record the exact rc version when testing)
- Model
- To fill
- Mode / permissions
- Standard mode + modify-within-workspace is enough to start
- Plugins required
- None (add name & version after testing if used)
- Input materials
- Keep in a separate workspace; back up originals first
Full instruction
For [function source / file path], generate unit tests. Do not modify production code.
Requirements:
1. Cover: normal input, boundary values, empty / nil / exception input, obvious misuse.
2. Each case states input, expected output, and why it is worth testing.
3. Use the project's existing test framework; if unsure, ask me first, don't add a new dependency.
4. After generating, state which branches are still uncovered.
5. Give 3 representative cases first for style confirmation, then complete.Run log
| Item | Value | Note |
|---|---|---|
| Time spent | to be tested | |
| Result | to be tested | |
| In / out tokens | to be tested | |
| Leftovers | to be tested |
Output
After a successful run, list files and screenshots here, and note whether originals changed.
Acceptance checklist
Tap to tick each item off as you verify.
- Tests only add files; production code unchanged
- Boundary and error branches covered
- Uncovered branches stated
- Project's existing framework used
Failures & boundaries
- Generated tests may themselves be wrong; run them first
- Confirm framework before writing if inconsistent
- This is a recipe template and has not been tested on this site
- Blocked on: Runnable on a real repo, but 'are these tests any good' must be measured by coverage change and whether they catch a known bug, which means wiring coverage tooling and planting a defect.