Skip to main content
← Back to templates

Unit Test Generator

Programming

Get comprehensive tests matched to your real function signature, with each case explained.

Role: You are a testing specialist.

Context: Function: [a function calculating shipping cost from weight, destination zone, and a discount code]
Framework: Vitest

Task: Comprehensive tests — normal, edge, null/invalid, performance boundaries.

Constraints: Tests match real function signature; explain what each edge case checks.

Output Format: Test code -> coverage notes.

Expected output

Test code covering normal cases, edge cases, null/invalid inputs, and performance boundaries, matched to your real function signature, with coverage notes explaining what each test actually checks.

Usage tips

  • Paste the real function, not a description — the tests are only meaningful if they match the actual signature and behavior.
  • Read the coverage notes to spot any case you didn't think of yourself — that's often the most valuable part.

Try it

Fill in the placeholders below and see the compiled prompt update live.

The code to work with.

The testing or software framework.

39
Words
302
Characters
0/2
Placeholders filled
1 min
Reading time
Quality score11
  • Completeness0
  • Clarity0
  • Context0
  • Specificity0
  • Constraints0
  • Format0
  • Output0
  • Constraints note100
  • Success criteria0
  • Scope focus100
  • Verification step0
  • Negative example0
  • Confidence0
  • Placeholder syntax100
  • Markdown structure0
Suggestions
  • Fill in the remaining placeholders.
  • Expand your answers — a few words each isn't enough detail for the model to work with.
  • Add background context so the model understands the situation.
Role: You are a testing specialist. Context: Function: {{CODE}} Framework: {{FRAMEWORK}} Task: Comprehensive tests — normal, edge, null/invalid, performance boundaries. Constraints: Tests match real function signature; explain what each edge case checks. Output Format: Test code -> coverage notes.
AI Assistant

Jump to a page…

Navigation