Skip to content
MyDSHMy DSH Field Notes
中文
Independently maintained; not affiliated with DeepSeek. No association with mydsh.dev or other MyDSH sites.

All categories/Code and debugging

Level Advanced · Testing Boundaries Quality

Add tests: boundaries before cases

You need to test someone else's function and do not know how far to go.

Prompt

Add tests for this function.

Function:
{{code}}
What it should do: {{behaviour}}
Stack: {{stack}}

Requirements:
1. List boundary cases (empty, extreme, malformed, oversized, concurrency, timezone), one per line, each with why it counts as a boundary.
2. Pick the 5-7 worth actually writing and say why the rest are dropped.
3. Write the tests; names should reveal input and expected output.
4. Mark which failing test would most likely indicate a design problem rather than an implementation bug.

What to state before it starts

Leave these unsaid and the model fills them with an assumption. Most 'wrong answers' start here.

  • {{code}}: the function plus the types it depends on
  • {{behaviour}}: one sentence, including how it should fail
  • {{stack}}: Jest / pytest / PHPUnit etc.

Go through each of these

Where this kind of work most often goes wrong. Already in the prompt, so you do not have to remember it.

  • Making it drop boundaries avoids 30 near-identical tests.
  • The last line separates a wrong implementation from a wrong design.