Write Unit Tests: review unit test cases

For unit tests, bring the rough note "Need test cases, names, assertions, and edge cases. Existing tests use Vitest. Avoid testing implementation details." and turn it into unit test cases with edge cases, assertions, fixtures, failure mode, and existing test style visible from the first pass.

Start with the right jobUse this workflow when your note, output, and switch point line up.
First move
Start unit tests only after the audience, source material, stop rule, and reviewer for unit test cases quality, edge cases and assertions, and codebase verification are named; otherwise collect context before copying.
Keep after run
Keep after the unit tests run: the original note, the variables that changed the answer, and the section where actual error output, code behavior, and passing verification is separated from assumptions before reuse.
Wrong page signal
Wrong page signal: switch to ChatGPT Prompts for Developers if the user cannot supply function behavior, edge cases, inputs, outputs, and existing test style, if the desired result is not unit test cases, or if edge cases, assertions, fixtures, failure mode, and existing test style is no longer the controlling choice.

First usable run

Start with the note you actually have1/3 ready

A realistic example is loaded. Try the flow once, then clear it and paste your own working notes.
Next stepFinish the run setup2 items still need context before this becomes reusable.
Current note
  1. PrepareSource noteReal notes are loaded.
  2. RunCopy run prompt2 checks before copy.
  3. ReviewReview answerCurrent choice: Repair.
  4. SaveSave reusable version0/3 save checks closed.
Keep working laterPage work stays on this device until you save it.
Try the sample firstSee one messy note become a usable write unit tests run
Messy input
A rough unit tests note comes in: "Need test cases, names, assertions, and edge cases. Existing tests use Vitest. Avoid testing implementation details." is the rough request. Before reusing unit tests, the usable version reads as unit test cases, keeps edge cases, assertions, fixtures, failure mode, and existing test style visible, names the checker, and protects this boundary: verify against the actual codebase and test results before using.
Better answer should
A usable unit tests handoff would return unit test cases with named sections, action bullets, and a final reviewer pass; split the user's pasted facts from anything ChatGPT inferred, put the reviewer beside the section they must approve, prepare test case table with edge conditions, and center the last read on unit test cases quality, edge cases and assertions, and codebase verification.
Human edit
developer should revise the unit test cases work answer by keeping the parts that saved review time, add missing edge cases and remove tests that only mirror the implementation, replace private or one-off details with reusable fields, and shape the closing version for a code reviewer, teammate, maintainer, or future self; check it against "Need test cases, names, assertions, and edge cases. Existing tests use Vitest. Avoid testing implementation details." and keep this final standard visible: the developer review should check that tests fail for the right reason, avoid over-mocking, and cover the edge cases users can trigger.
Fix before reuse2 gaps before reuseCopy can start the first pass, but the answer is not reusable until these checks are closed.
  • Separate facts from assumptionsMark which must-keep details came from the user and which details still need a person to check them.
  • Name the checker and stop ruleWrite Unit Tests review starts with source support, with actual error output, code behavior, and passing verification and edge cases, assertions, fixtures, failure mode, and existing test style as the two hard checks. must know what to reject before the answer is reused.
Real note
Need test cases, names, assertions, and edge cases. Existing tests use Vitest. Avoid testing implementation details. Phrase shopping fails for unit test cases work because the note should become test case table with edge conditions. The user's note should stay readable after the answer is organized. This unit test cases work run should turn that note into unit test cases. For unit test cases work, paste the source as bullets, constraints, and audience notes so the model has enough shape for a technical checklist with hypotheses, steps, risks, and verification commands.
What will change
Start by pasting the rough note, then replace the variables that control audience, source material, and the reviewer for unit test cases quality, edge cases and assertions, and codebase verification.
Human check
Source review, write unit tests: the answer uses the supplied function behavior, edge cases, inputs, outputs, and existing test style and does not fill missing facts with confident guesses.
Open run previewCheck the exact prompt before copying.
Run prompt preview

Copy this after checking the notes

Task: ChatGPT Prompts for Developers to Write Unit Tests
Who checks it: Write Unit Tests review starts with source support, with actual error output, code behavior, and passing verification and edge cases, assertions, fixtures, failure mode, and existing test style as the two hard checks.

Paste source notes:
Need test cases, names, assertions, and edge cases. Existing tests use Vitest. Avoid testing implementation details. Phrase shopping fails for unit test cases work because the note should become test case table with edge conditions. The user's note should stay readable after the answer is organized. This unit test cases work run should turn that note into unit test cases. For unit test cases work, paste the source as bullets, constraints, and audience notes so the model has enough shape for a technical checklist with hypotheses, steps, risks, and verification commands.

Must keep:
Need test cases, names, assertions, and edge cases. Existing tests use Vitest. Avoid testing implementation details.
function behavior, edge cases, inputs, outputs, and existing test style
edge cases, assertions, fixtures, failure mode, and existing test style

Do not allow:
Reject the answer if it invents facts, numbers, policy claims, citations, credentials, or examples that were not in the notes.
Reject it if the output sounds polished but does not become unit test cases.

Readiness before copy:
- Separate facts from assumptions: Mark which must-keep details came from the user and which details still need a person to check them.
- Name the checker and stop rule: Write Unit Tests review starts with source support, with actual error output, code behavior, and passing verification and edge cases, assertions, fixtures, failure mode, and existing test style as the two hard checks. must know what to reject before the answer is reused.

Run prompt:
Run this evidence-aware working copy prompt for Developers; stay practical, cite the pasted notes, and leave the final call with the human reviewer.
Task: help me with unit test cases work. Target result: unit test cases.
Source material I can provide: [source_material]. Typical source for this task is function behavior, edge cases, inputs, outputs, and existing test style.
Audience or stakeholder: [audience]. The output must work for a code reviewer, teammate, maintainer, or future self.
Task-specific focus to preserve: [task_focus]. If the pasted focus is broad, compare it with this page cue: edge cases, assertions, fixtures, failure mode, and existing test style.
Goal: [goal]. Constraints: [constraints]. Fact boundary for this run: keep actual error output, code behavior, and passing verification tied to [source_material], and mark any detail the notes do not support.
Run mode for unit test cases work: Run this as the first usable version: use the supplied fields, label assumptions, and produce the main artifact.
Stop rule: Stop if the request asks you to invent facts, evidence, credentials, numbers, or private details.
Return a technical checklist with hypotheses, steps, risks, and verification commands.
Before writing unit test cases, ask up to 3 clarifying questions when [source_material] does not include function behavior, edge cases, inputs, outputs, and existing.
After the answer, include a human review section focused on [review_lens]. Verify actual error output, code behavior, and passing verification; and respect this boundary: verify against the actual codebase and test results before using.
Check cue: for unit test cases work, The user should get a working version they can inspect against the supplied notes.

Stop rule: Reject the answer if it invents facts, numbers, policy claims, citations, credentials, or examples that were not in the notes.
Record to keep: Save a short record of the original note, the prompt variables that changed the answer, the section that still needs unit test cases quality, edge cases and assertions, and codebase verification, and the final reason the accepted version can become unit tests prompt pattern with source notes, constraints, and review checklist.
Open answer reviewUse this after ChatGPT returns the first answer.
After ChatGPT answers

Check the answer before saving it

Check against
Source review, write unit tests: the answer uses the supplied function behavior, edge cases, inputs, outputs, and existing test style and does not fill missing facts with confident guesses. Output shape, write unit tests: the result clearly becomes unit test cases, not broad advice about the task.
Reject if
Evidence issue, write unit tests: the answer invents or overstates actual error output, code behavior, and passing verification. Task drift, write unit tests: it ignores edge cases, assertions, fixtures, failure mode, and existing test style and moves into a neighboring workflow.
Keep after run
Save a short record of the original note, the prompt variables that changed the answer, the section that still needs unit test cases quality, edge cases and assertions, and codebase verification, and the final reason the accepted version can become unit tests prompt pattern with source notes, constraints, and review checklist.
Open first answer choiceChoose accept, repair, or reject only after review.
First answer choice

Pick accept, repair, or reject before reuse

After the first write unit tests answer, the developer should choose Accept, Repair, or Reject before saving anything as unit tests prompt pattern with source notes, constraints, and review checklist. The choice must compare "Need test cases, names, assertions, and edge cases. Existing tests use Vitest. Avoid testing implementation details." with a technical checklist with hypotheses, steps, risks, and verification commands, edge cases, assertions, fixtures, failure mode, and existing test style, and actual error output, code behavior, and passing verification.

Choose when
Choose Repair when the answer has a useful shape but loses one of the required pieces: edge cases, assertions, fixtures, failure mode, and existing test style, actual error output, code behavior, and passing verification, the reviewer role, the source note, or the reusable fields needed for unit tests prompt pattern with source notes, constraints, and review checklist.
Do next
Ask ChatGPT for a second pass that keeps the usable structure, rewrites only the weak sections, adds missing support questions, and returns unit test cases in a technical checklist with hypotheses, steps, risks, and verification commands without inventing details.
Keep after run
Keep the weak answer beside the repair note, mark which line failed unit test cases quality, edge cases and assertions, and codebase verification, and save the corrected line only after it can be traced back to "Need test cases, names, assertions, and edge cases. Existing tests use Vitest. Avoid testing implementation details.".
Answer choice prompt
Repair this write unit tests answer instead of accepting it. Source note: "Need test cases, names, assertions, and edge cases. Existing tests use Vitest. Avoid testing implementation details." Weak answer: [paste_chatgpt_output_here]. Preserve any useful structure, but fix the parts that hide edge cases, assertions, fixtures, failure mode, and existing test style, turn actual error output, code behavior, and passing verification into unsupported certainty, or skip the reviewer for unit test cases quality, edge cases and assertions, and codebase verification. Return a repaired a technical checklist with hypotheses, steps, risks, and verification commands, a list of changed lines, and one remaining question before this can become unit tests prompt pattern with source notes, constraints, and review checklist.

Do not save a reusable unit tests prompt pattern with source notes, constraints, and review checklist until one option has a written choice. The saved version must keep "Need test cases, names, assertions, and edge cases. Existing tests use Vitest. Avoid testing implementation details." as the example, turn private or one-time details into variables, and keep the risk check "verify against the actual codebase and test results before using" visible for the next run.

Open run logRecord what happened after each ChatGPT run.
Run notes

Save the answer, problem, and next try

Use this after the first answer. A reusable prompt improves when each run records what failed and what to try next.

  1. 0No run notes yet

    Run the prompt once, review the answer, then save the problem and next try here.

Open saved versionTurn the reviewed answer into a reusable saved version.
Saved version

Save the final answer, human edit, and variables

Save only after review. The reusable version needs the answer, the human edit, and the reuse rule in one place.

Saved version preview
Final saved version for: ChatGPT Prompts for Developers to Write Unit Tests
Who checks it: The human owner who approves the final packet for Developers to Write Unit Tests before it is saved, shared, or reused.
Use or revise before saving: Repair

Save only after review:
- Source review, write unit tests: the answer uses the supplied function behavior, edge cases, inputs, outputs, and existing test style and does not fill missing facts with confident guesses.
- Save a short record of the original note, the prompt variables that changed the answer, the section that still needs unit test cases quality, edge cases and assertions, and codebase verification, and the final reason the accepted version can become unit tests prompt pattern with source notes, constraints, and review checklist.
- Store the source note, the fields that changed the output, the checked line, and the reason the result belongs with a code reviewer, teammate, maintainer, or future self.
- Current answer choice: Keep the weak answer beside the repair note, mark which line failed unit test cases quality, edge cases and assertions, and codebase verification, and save the corrected line only after it can be traced back to "Need test cases, names, assertions, and edge cases. Existing tests use Vitest. Avoid testing implementation details.".

Source note used:
Need test cases, names, assertions, and edge cases. Existing tests use Vitest. Avoid testing implementation details. Phrase shopping fails for unit test cases work because the note should become test case table with edge conditions. The user's note should stay readable after the answer is organized. This unit test cases work run should turn that note into unit test cases. For unit test cases work, paste the source as bullets, constraints, and audience notes so the model has enough shape for a technical checklist with hypotheses, steps, risks, and verification commands.

Final answer:
A usable unit tests handoff would return unit test cases with named sections, action bullets, and a final reviewer pass; split the user's pasted facts from anything ChatGPT inferred, put the reviewer beside the section they must approve, prepare test case table with edge conditions, and center the last read on unit test cases quality, edge cases and assertions, and codebase verification.

Human edit:
developer should revise the unit test cases work answer by keeping the parts that saved review time, add missing edge cases and remove tests that only mirror the implementation, replace private or one-off details with reusable fields, and shape the closing version for a code reviewer, teammate, maintainer, or future self; check it against "Need test cases, names, assertions, and edge cases. Existing tests use Vitest. Avoid testing implementation details." and keep this final standard visible: the developer review should check that tests fail for the right reason, avoid over-mocking, and cover the edge cases users can trigger.

Reusable variables:
[source_material]: function behavior, edge cases, inputs, outputs, and existing test style
[audience]: a code reviewer, teammate, maintainer, or future self
[goal]: make unit test cases easier to review, adapt, and use in a real developers workflow
[constraints]: verify against the actual codebase and test results before using

Reuse rule: Reuse unit tests only after private details are removed, one-time facts become variables, add missing edge cases and remove tests that only mirror the implementation, and the review rule for edge cases, assertions, fixtures, failure mode, and existing test style still appears in the reusable prompt. Approval for developers unit tests belongs with the accountable reviewer before the answer reaches a code reviewer, teammate, maintainer, or future self; keep the test case table with edge conditions review standard visible.
Stop if: Reject the answer if it invents facts, numbers, policy claims, citations, credentials, or examples that were not in the notes.

First run setup

Set up the first run

Edit notes
First move
Start by pasting the rough note, then replace the variables that control audience, source material, and the reviewer for unit test cases quality, edge cases and assertions, and codebase verification.
Bring first
Bring the rough case note: Need test cases, names, assertions, and edge cases. Existing tests use Vitest. Avoid testing implementation details.
Switch if
The user cannot provide function behavior, edge cases, inputs, outputs, and existing test style and would need ChatGPT to invent the important facts.
Keep after run
Save a short record of the original note, the prompt variables that changed the answer, the section that still needs unit test cases quality, edge cases and assertions, and codebase verification, and the final reason the accepted version can become unit tests prompt pattern with source notes, constraints, and review checklist.
Choose where you areGo to runner
Go to runnerWithin five minutes, the user should have a first unit tests prompt pattern with source notes, constraints, and review checklist, one copied run prompt, and a reviewer check that keeps unit test cases quality, edge cases and assertions, and codebase verification and actual error output, code behavior, and passing verification visible before sharing anything. Start with: Start by pasting the rough note, then replace the variables that control audience, source material, and the reviewer for unit test cases quality, edge cases and assertions, and codebase verification.
Go to runner
Open switch notesWhat to bring, who checks it, and when to change workflows.
Who checks it

Write Unit Tests review starts with source support, with actual error output, code behavior, and passing verification and edge cases, assertions, fixtures, failure mode, and existing test style as the two hard checks.

Check before using

Inspect function behavior, edge cases, inputs, outputs, and existing test style, the case note "Need test cases, names, assertions, and edge cases. Existing tests use Vitest. Avoid testing implementation details.", and any open support around actual error output, code behavior, and passing verification; the answer should keep supplied notes, assumptions, and needs-checking points separate.

Compare later

Result unit tests developers check: open the top results and record whether they solve the task, not only a prompt phrase.

Visitor question
I have function behavior, edge cases, inputs, outputs, and existing test style and need unit test cases for a code reviewer, teammate, maintainer, or future self; can this write unit tests page turn "Need test cases, names, assertions, and edge cases. Existing tests use Vitest. Avoid testing implementation details." into a technical checklist with hypotheses, steps, risks, and verification commands without hiding edge cases, assertions, fixtures, failure mode, and existing test style?
5-minute outcome
Within five minutes, the user should have a first unit tests prompt pattern with source notes, constraints, and review checklist, one copied run prompt, and a reviewer check that keeps unit test cases quality, edge cases and assertions, and codebase verification and actual error output, code behavior, and passing verification visible before sharing anything.
Wrong page signal
This is the wrong page if the work is closer to ChatGPT Prompts for Developers, if edge cases, assertions, fixtures, failure mode, and existing test style is not the controlling choice, or if the user only wants broad ideas instead of a reviewable unit test cases.
Why this workflow fits
Save the rough note, the accepted prompt variables, the unit tests query language, and the section that shows why this unit test cases should stay separate from ChatGPT Prompts for Developers.
Reuse choice
Reuse the output only when the answer traces back to function behavior, edge cases, inputs, outputs, and existing test style, respects the risk check "verify against the actual codebase and test results before using", and gives a code reviewer, teammate, maintainer, or future self a clear accept, repair, or reject path.

Wrong page? ChatGPT Prompts for DevelopersReturn to the role guide to choose by situation, output, and reviewer.

First run

Run this page in four moves

Concrete outputA usable unit tests handoff would return unit test cases with named sections, action bullets, and a final reviewer pass; split the user's pasted facts from anything ChatGPT inferred, put the reviewer beside the section they must approve, prepare test case table with edge conditions, and center the last read on unit test cases quality, edge cases and assertions, and codebase verification.
Keep after runSave a short record of the original note, the prompt variables that changed the answer, the section that still needs unit test cases quality, edge cases and assertions, and codebase verification, and the final reason the accepted version can become unit tests prompt pattern with source notes, constraints, and review checklist.
Reject before reuseReject the answer if it invents facts, numbers, policy claims, citations, credentials, or examples that were not in the notes.

Work notes

Start from the real note, not a blank prompt

Current input
Need test cases, names, assertions, and edge cases. Existing tests use Vitest. Avoid testing implementation details. Phrase shopping fails for unit test cases work because the note should become test case table with edge conditions. The user's note should stay readable after the answer is organized. This unit test cases work run should turn that note into unit test cases. For unit test cases work, paste the source as bullets, constraints, and audience notes so the model has enough shape for a technical checklist with hypotheses, steps, risks, and verification commands.
First move
Start by pasting the rough note, then replace the variables that control audience, source material, and the reviewer for unit test cases quality, edge cases and assertions, and codebase verification.
Who checks it
Write Unit Tests review starts with source support, with actual error output, code behavior, and passing verification and edge cases, assertions, fixtures, failure mode, and existing test style as the two hard checks.
Stop rule
Reject the answer if it invents facts, numbers, policy claims, citations, credentials, or examples that were not in the notes.
Keep after run
Save a short record of the original note, the prompt variables that changed the answer, the section that still needs unit test cases quality, edge cases and assertions, and codebase verification, and the final reason the accepted version can become unit tests prompt pattern with source notes, constraints, and review checklist.
Do not start if
Stop if the answer sounds polished but still cannot show the source notes behind edge cases, assertions, fixtures, failure mode, and existing test style.
Human check
Source review, write unit tests: the answer uses the supplied function behavior, edge cases, inputs, outputs, and existing test style and does not fill missing facts with confident guesses.

Real note check

Check the answer against your note

This works best when the answer stays tied to the note you pasted, the question people search, and the person who can review it.

Question to compare: chatgpt prompts for developers unit tests

Open reference checks
Paste into ChatGPT
Need test cases, names, assertions, and edge cases. Existing tests use Vitest. Avoid testing implementation details. Phrase shopping fails for unit test cases work because the note should become test case table with edge conditions. The user's note should stay readable after the answer is organized. This unit test cases work run should turn that note into unit test cases. For unit test cases work, paste the source as bullets, constraints, and audience notes so the model has enough shape for a technical checklist with hypotheses, steps, risks, and verification commands.
Question to compare
chatgpt prompts for developers unit testsResult unit tests developers check: open the top results and record whether they solve the task, not only a prompt phrase.
Reference page
MDN Web Docs learning and reference documentationUsed for developer prompts where examples, tests, documentation, and implementation guidance should be grounded in reviewable technical references.
Who checks it
Write Unit Tests review starts with source support, with actual error output, code behavior, and passing verification and edge cases, assertions, fixtures, failure mode, and existing test style as the two hard checks.Inspect function behavior, edge cases, inputs, outputs, and existing test style, the case note "Need test cases, names, assertions, and edge cases. Existing tests use Vitest. Avoid testing implementation details.", and any open support around actual error output, code behavior, and passing verification; the answer should keep supplied notes, assumptions, and needs-checking points separate.

Use this unit tests page when developers already have function behavior, edge cases, inputs, outputs, and existing test style and need the answer to become unit test cases, not a loose idea list. The prompt should ask for function behavior, edge cases, inputs, outputs, and existing test style, the audience, the intended channel, and the constraints before it tries to format the result. unit tests artifact check: inspect test case table with edge conditions before accepting the answer. Accept the answer only when unit test cases quality, edge cases and assertions, and codebase verification can be checked and the open questions are visible. AI-assisted code must be reviewed, tested, and adapted to the actual codebase. Before using the output, run the follow-up prompt and check the result against the real context for a code reviewer, teammate, maintainer, or future self.

Real use plan for treating the prompt like a work note

0/12 checked

The write unit tests plan starts with the rough note, then forces a check against unit test cases quality, edge cases and assertions, and codebase verification before unit test cases reaches a code reviewer, teammate, maintainer, or future self; that keeps the useful structure while making unsupported claims easy to reject.

Before copying

After ChatGPT answers

Reject the answer if

Choose the next move

Start by turning the rough request into named fields before asking for unit test cases.

Build The Asset

Use this when the notes are ready and the next useful output is a technical checklist with hypotheses, steps, risks, and verification commands, not more brainstorming.

Open section
Do now
Copy the recommended prompt, replace the variables, and ask for unit test cases with assumptions separated from source-backed details.
Bring first
Bring the task focus: edge cases, assertions, fixtures, failure mode, and existing test style. Add the channel, deadline, and any required sections.
Stop if
Stop if the first answer gives broad advice instead of a concrete unit test cases.
Next check
Use the run sheet's review mode before sharing anything with a code reviewer, teammate, maintainer, or future self.

Know when the answer is ready

Use this quick check before saving the answer, rerunning the prompt, or switching to a neighboring workflow.

Ready signal

Finish the run only when the pasted request "Need test cases, names, assertions, and edge cases. Existing tests use Vitest. Avoid testing implementation details." becomes unit test cases with named sections, action bullets, and a final reviewer pass, keeps edge cases, assertions, fixtures, failure mode, and existing test style visible, and gives the person approving unit test cases a named accept, revise, or discard call before sharing with a code reviewer, teammate, maintainer, or future self.

First run action

Open with the rough note function behavior, edge cases, inputs, outputs, and existing test style, the intended unit test cases, the audience, the stop rule "verify against the actual codebase and test results before using", and the support needed for actual error output, code behavior, and passing verification.

Keep after run
Save a short record of the original note, the prompt variables that changed the answer, the section that still needs unit test cases quality, edge cases and assertions, and codebase verification, and the final reason the accepted version can become unit tests prompt pattern with source notes, constraints, and review checklist.
Use or revise
the person approving unit test cases should approve the output only if it can be traced back to function behavior, edge cases, inputs, outputs, and existing test style, shows what is assumed, and does not turn actual error output, code behavior, and passing verification into a confident claim without review.
What makes this page different
This page can beat a short generic collection by tying the query "chatgpt prompts for developers unit tests" to a fillable prompt, a realistic case, an answer repair path, and a no-fake-metrics support boundary instead of only listing prompt phrases.
Why this page exists
This page deserves its own workflow for the unit tests query because unit test cases changes the source material, reviewer, output shape, and failure mode; sending the user to a nearby developer page would hide edge cases, assertions, fixtures, failure mode, and existing test style and weaken the final unit test cases.

Second pass

Second pass before the answer becomes reusable

Source line

Editor margin source for unit test cases work: "Need test cases, names, assertions, and edge cases. Existing tests use Vitest. Avoid testing implementation details." It is the sentence most likely to disappear when a smooth answer starts too quickly.

Human check note

a working editor checking unit test cases quality, edge cases and assertions, and codebase verification reads the first ChatGPT answer beside the rough note and decides what survives. The pass is intentionally narrow: preserve the note, remove unsupported confidence, ask for the missing support, then rewrite only the part that changes the choice. The check belongs before the prompt is saved as unit tests prompt pattern with source notes, constraints, and review checklist.

Keep

the rough note "Need test cases, names, assertions, and edge cases. Existing tests use Vitest. Avoid testing implementation details" as the visible source line for unit test cases

Keep this because the rough note is the only part a developer can compare against the answer when a technical checklist with hypotheses, steps, risks, and verification commands starts to sound finished.

The accepted answer should repeat or clearly map back to "Need test cases, names, assertions, and edge cases. Existing tests use Vitest. Avoid testing implementation details." before it adds structure.
Cut

any confident claim about actual error output, code behavior, and passing verification that the pasted note does not prove

Cut it because the support around actual error output, code behavior, and passing verification is the review risk for this page, and fluent wording can make an unsupported detail look approved.

If the source note does not show the fact, the answer should move it into a needs-checking line or remove it.
Ask

the missing audience, owner, or review detail needed before a code reviewer, teammate, maintainer, or future self uses the answer

Ask before reuse because unit test cases only helps a code reviewer, teammate, maintainer, or future self when the channel, approval owner, and open support are visible.

The next run should name the missing field instead of burying it inside a polished answer.
Rewrite

the first polished paragraph so it shows edge cases, assertions, fixtures, failure mode, and existing test style before tone improvements

Rewrite the opening because this task is about edge cases, assertions, fixtures, failure mode, and existing test style, not a general unit test cases answer that could fit any role page.

A reviewer should see edge cases, assertions, fixtures, failure mode, and existing test style in the first accepted section and again in the saved reuse rule.

Why this feels hand-edited

a working editor checking unit test cases quality, edge cases and assertions, and codebase verification leaves this margin pass because the workflow has to protect a real source note, not only offer another prompt. For developers working on unit test cases, the human-feeling part is the specific tradeoff: keep "Need test cases, names, assertions, and edge cases. Existing tests use Vitest. Avoid testing implementation details.", cut unsupported certainty, ask for the missing owner, and rewrite the answer around edge cases, assertions, fixtures, failure mode, and existing test style. That support trail makes the page feel edited rather than assembled from repeated blocks.

Run the second pass

Run an editorial margin pass for this task. Source note: "Need test cases, names, assertions, and edge cases. Existing tests use Vitest. Avoid testing implementation details." Output being reviewed: [paste ChatGPT answer]. Mark four choices: Keep the source-backed detail that should survive, Cut any unsupported claim about actual error output, code behavior, and passing verification, Ask the missing question that blocks a code reviewer, teammate, maintainer, or future self from using the result, and Rewrite the section so edge cases, assertions, fixtures, failure mode, and existing test style stays visible before polish. End with one accept, repair, or reject choice and a reuse rule for unit tests prompt pattern with source notes, constraints, and review checklist.

Task actions for the next useful move

Start by pasting the rough note, then replace the variables that control audience, source material, and the reviewer for unit test cases quality, edge cases and assertions, and codebase verification.

Wrong page ifThe user cannot provide function behavior, edge cases, inputs, outputs, and existing test style and would need ChatGPT to invent the important facts.
Stay hereThe page is for the moment when developers have enough notes to create unit test cases, but still need a choice about edge cases, assertions, fixtures, failure mode, and existing test style. First move: Start by pasting the rough note, then replace the variables that control audience, source material, and the reviewer for unit test cases quality, edge cases and assertions, and codebase verification.
Switch ifChatGPT Prompts for DevelopersReturn to the role guide to choose by situation, output, and reviewer.
Stop ifThe user cannot provide function behavior, edge cases, inputs, outputs, and existing test style and would need ChatGPT to invent the important facts. The desired result is not unit test cases or cannot be shaped as a technical checklist with hypotheses, steps, risks, and verification commands.
Not forUsers who want ChatGPT to invent facts, credentials, numbers, or personal details. Situations where the output needs final approval from a qualified human before it reaches a code reviewer, teammate, maintainer, or future self.

Before you use the answer, make the call

Who checks it
Before handoff, the owner who will hand this to a code reviewer, teammate, maintainer, or future self compares the answer with the rough case note for unit test cases work and decides what can reach a code reviewer, teammate, maintainer, or future self.
Check before using
Inspect function behavior, edge cases, inputs, outputs, and existing test style, the case note "Need test cases, names, assertions, and edge cases. Existing tests use Vitest. Avoid testing implementation details.", and any open support around actual error output, code behavior, and passing verification; the answer should keep supplied notes, assumptions, and needs-checking points separate.
What this changes
The user should leave judging readiness, not shopping for wording: does this unit test cases show edge cases, assertions, fixtures, failure mode, and existing test style, name what came from function behavior, edge cases, inputs, outputs, and existing test style, and give a code reviewer, teammate, maintainer, or future self a clear next step?
Do next
The developer review should check that tests fail for the right reason, avoid over-mocking, and cover the edge cases users can trigger. Then save only the repeatable fields, not the one-time case details, so the next run still asks for unit test cases quality, edge cases and assertions, and codebase verification.
Before saving for reuse
Before reusing the answer, keep any search, traffic, ranking, or popularity claim out of the final asset unless someone can point to search performance tool evidence or other real search data after publishing for "chatgpt prompts for developers unit tests" and record where it came from.

Working case file: Write Unit Tests working case for Developers

This is the work moment before a developer should copy the prompt. The user has enough material to start, but not enough to trust a smooth answer unless the prompt keeps function behavior, edge cases, inputs, outputs, and existing test style, a technical checklist with hypotheses, steps, risks, and verification commands, and the person approving unit test cases in the same run.

Rough note

A developer added a function that normalizes search filters and needs tests for empty input, multiple filters, and URL parameter order. The rough note says: "Need test cases, names, assertions, and edge cases. Existing tests use Vitest. Avoid testing implementation details." The desired result is unit test cases for a code reviewer, teammate, maintainer, or future self.

Constraint to keep visible

The answer has to protect edge cases, assertions, fixtures, failure mode, and existing test style before it improves wording. Carry this rule into every section: verify against the actual codebase and test results before using.

What the user brought

The supplied case is "Need test cases, names, assertions, and edge cases. Existing tests use Vitest. Avoid testing implementation details.", so the answer should begin from the user's actual wording and not from broad write unit tests advice.

The finished unit test cases should point back to function behavior, edge cases, inputs, outputs, and existing test style and show how edge cases, assertions, fixtures, failure mode, and existing test style changed the answer.

What is still missing

The model should ask for audience, channel, approval owner, and any support needed for actual error output, code behavior, and passing verification before it treats the result as usable.

Missing inputs belong in a needs-checking line, not inside polished wording that a code reviewer, teammate, maintainer, or future self might treat as settled.

Who accepts the answer

the person approving unit test cases should inspect unit test cases quality, edge cases and assertions, and codebase verification, compare the answer with the rough note, and decide whether the output is ready, repairable, or too thin.

The page should leave a visible owner for the final check instead of implying that ChatGPT approval is enough.

What gets saved

The reusable version should keep variables for source notes, audience, reviewer, support need, stop rule, and edge cases, assertions, fixtures, failure mode, and existing test style.

One-time details should be removed only after the accepted answer proves that a technical checklist with hypotheses, steps, risks, and verification commands works for this case.

Before copying

  • Can the user point to the exact function behavior, edge cases, inputs, outputs, and existing test style ChatGPT is allowed to use?
  • Is edge cases, assertions, fixtures, failure mode, and existing test style visible before the prompt asks for unit test cases?
  • Has the user named the reviewer who checks unit test cases quality, edge cases and assertions, and codebase verification?
  • Is there a stop rule for unsupported claims about actual error output, code behavior, and passing verification?

Checks before sharing

  • Compare the first answer with "Need test cases, names, assertions, and edge cases. Existing tests use Vitest. Avoid testing implementation details." and mark any section that invents context.
  • Check whether the output is shaped as a technical checklist with hypotheses, steps, risks, and verification commands, not a general explanation.
  • Move uncertain claims into a needs-checking block before sharing the answer with a code reviewer, teammate, maintainer, or future self.
  • Save the pattern as unit tests prompt pattern with source notes, constraints, and review checklist only after private or one-time details become variables.

Run this case first

Use this case file before writing. Start from this rough note: "Need test cases, names, assertions, and edge cases. Existing tests use Vitest. Avoid testing implementation details." Build unit test cases as a technical checklist with hypotheses, steps, risks, and verification commands. Keep edge cases, assertions, fixtures, failure mode, and existing test style visible, separate supplied facts from assumptions, ask for missing support around actual error output, code behavior, and passing verification, name the person approving unit test cases as the checker, and stop before using any claim that the source notes do not support.

Ready means the result can move to a code reviewer, teammate, maintainer, or future self with supplied notes, assumptions, and checks still separated. The accepted version should tell a code reviewer, teammate, maintainer, or future self what is ready, what needs checking, and which fields the next user must replace before rerunning the prompt.

Input triage before running ChatGPT

Which problem is most likely to break this write unit tests run before a code reviewer, teammate, maintainer, or future self can use it?

Selected issue

Missing context

Build context
Symptom
Write Unit Tests starts from a rough note like "Need test cases, names, assertions, and edge cases. Existing tests use Vitest. Avoid testing implementation details." but the audience, choice, or approval point is still implied.
Ask now
What does a code reviewer, teammate, maintainer, or future self already know, what source notes are available, and what must the final unit test cases decide?
Do next
Start by rewriting the rough note into named fields before asking for a technical checklist with hypotheses, steps, risks, and verification commands, then confirm the reviewer can inspect each field.
Prompt move
Before writing, ask me up to four questions needed to produce a technical checklist with hypotheses, steps, risks, and verification commands; do not fill gaps with assumptions.
Stop if
Stop if the answer sounds polished but still cannot show the source notes behind edge cases, assertions, fixtures, failure mode, and existing test style.
Who checks it
a code reviewer, teammate, maintainer, or future self
Build contextReadiness check

Notes to save before reusing this prompt

Sort the rough note "Need test cases, names, assertions, and edge cases. Existing tests use Vitest. Avoid testing implementation details." before running write unit tests in an engineering workflow where context, tests, and reproducibility matter. This note sheet tells ChatGPT what it may use, what it must label, and which part the owner sending this to a code reviewer, teammate, maintainer, or future self checks before a code reviewer, teammate, maintainer, or future self sees test case table with edge conditions. Unit test freshness check: recheck the latest behavior, changed files, and failing edge case before saving a test plan.

Details copied from the user's case

Capture
Capture the concrete case first: A developer added a function that normalizes search filters and needs tests for empty input, multiple filters, and URL parameter order. The note says "Need test cases, names, assertions, and edge cases. Existing tests use Vitest. Avoid testing implementation details." and the requested asset is test case table with edge conditions. Unit test freshness check: recheck the latest behavior, changed files, and failing edge case before saving a test plan.
Keep
Keep the facts that directly affect a technical checklist with hypotheses, steps, risks, and verification commands, especially the audience, task focus, channel, and any details already present in function behavior, edge cases, inputs, outputs, and existing test style.
Verify
Verify that every useful line in the answer can point back to the rough note or to function behavior, edge cases, inputs, outputs, and existing test style.
Prompt direction
Tell ChatGPT to use only listed facts for the first pass and to put any extra idea in a needs-checking line.
Who checks it
the owner sending this to a code reviewer, teammate, maintainer, or future self checks whether the answer still reflects unit test cases quality, edge cases and assertions, and codebase verification after the first pass.
If skipped
If this row is skipped, unit test cases can sound specific while drifting into generic write unit tests advice.

Guesses that need a review line

Capture
List what the user did not provide but the answer may need: missing audience detail, missing support around actual error output, code behavior, and passing verification, or an approval step for a code reviewer, teammate, maintainer, or future self.
Keep
Keep assumptions outside the usable sections until the user confirms them or chooses a safer fallback.
Verify
Check whether the answer names what is unknown before it recommends wording, order, or next steps.
Prompt direction
Ask ChatGPT to return a short assumption list before writing any final copy or checklist.
Who checks it
the owner sending this to a code reviewer, teammate, maintainer, or future self decides which assumptions are acceptable and which ones need another user answer.
If skipped
If assumptions are hidden, the answer may pass a style check while failing the real choice about edge cases, assertions, fixtures, failure mode, and existing test style.

Boundaries that decide readiness

Capture
Record the rule from this case: The prompt should ask for behavior, inputs, outputs, and existing test style before writing test cases. Also include verify against the actual codebase and test results before using and this field friction before the model writes: test suggestions can cover the happy path while missing the edge condition that caused the risk. Unit test failure sample: the answer writes happy-path tests that mirror the implementation and miss the edge case that created the risk.
Keep
Keep the constraint near the requested format so it governs the whole a technical checklist with hypotheses, steps, risks, and verification commands, not only the final paragraph.
Verify
Check whether the answer obeys the constraint even when it would be easier to produce a smoother or broader response.
Prompt direction
Tell ChatGPT to stop and ask before continuing if the constraint conflicts with the requested output.
Who checks it
the owner sending this to a code reviewer, teammate, maintainer, or future self checks the constraint before approving any handoff to a code reviewer, teammate, maintainer, or future self.
If skipped
If this row is skipped, the model may produce a fluent answer that the user cannot safely use.

Sensitive context to keep out

Capture
Mark names, private identifiers, account details, student or customer records, confidential strategy, and one-time case details before they enter the prompt.
Keep
Keep summaries that preserve meaning but remove details that should not travel into a reusable prompt.
Verify
Check whether the answer repeats private or one-time information that should have stayed outside the saved version.
Prompt direction
Ask ChatGPT to replace private details with role-safe descriptions and to flag anything it cannot safely generalize.
Who checks it
the owner sending this to a code reviewer, teammate, maintainer, or future self confirms that the final unit test cases can be shared in the intended channel.
If skipped
If this row is skipped, the page helps the user copy faster but may teach a bad reuse habit.

Items that should become blanks

Capture
Name the fields that should change next time: source notes, audience, output format, support needed for actual error output, code behavior, and passing verification, reviewer, and stop rule.
Keep
Keep edge cases, assertions, fixtures, failure mode, and existing test style, unit test cases quality, edge cases and assertions, and codebase verification, and test case table with edge conditions as required fields so the saved prompt does not collapse into a generic role prompt. Approval for developers unit tests belongs with the accountable reviewer before the answer reaches a code reviewer, teammate, maintainer, or future self; keep the test case table with edge conditions review standard visible.
Verify
Check whether the reusable version still asks for the facts that made this case work, instead of saving the finished wording alone.
Prompt direction
Tell ChatGPT to return a reusable prompt with variables and a reject-if rule after the human accepts the current answer.
Who checks it
the owner sending this to a code reviewer, teammate, maintainer, or future self signs off only when private details are removed and the next user can fill the variables without guessing.
If skipped
If this row is skipped, the user may save polished wording instead of a repeatable unit tests prompt pattern with source notes, constraints, and review checklist.

Copy these saved notes with the prompt only after the developer can point to the supplied facts, the uncertain parts, the hard limit, the reusable fields for edge cases, assertions, fixtures, failure mode, and existing test style, and the place where test suggestions can cover the happy path while missing the edge condition that caused the risk. Approval for developers unit tests belongs with the accountable reviewer before the answer reaches a code reviewer, teammate, maintainer, or future self; keep the test case table with edge conditions review standard visible. Outside support for unit tests with developers: an independent resource must mention the unit test cases page visibly before test case table with edge conditions becomes an authority claim.

Iteration loop: run the prompt as a working thread

Write Unit Tests works best as a short conversation, not as one copy action. Start from the rough note "Need test cases, names, assertions, and edge cases. Existing tests use Vitest. Avoid testing implementation details.", then ask ChatGPT to write, question, challenge, and hand off test case table with edge conditions without hiding actual error output, code behavior, and passing verification. Unit test freshness check: recheck the latest behavior, changed files, and failing edge case before saving a test plan.

Thread goal

Thread goal for developer: turn the rough case from A developer added a function that normalizes search filters and needs tests for empty input, multiple filters, and URL parameter order. into a technical checklist with hypotheses, steps, risks, and verification commands for a code reviewer, teammate, maintainer, or future self, while the reviewer accountable for unit test cases quality, edge cases and assertions, and codebase verification can still inspect unit test cases quality, edge cases and assertions, and codebase verification, edge cases, assertions, fixtures, failure mode, and existing test style, unsupported assumptions, and the friction that test suggestions can cover the happy path while missing the edge condition that caused the risk. Unit test failure sample: the answer writes happy-path tests that mirror the implementation and miss the edge case that created the risk.

Write Unit Tests is finished only when the handoff names what is ready, what still needs checking, and which fields become variables next time. The loop is stronger than a one-shot prompt because it makes the model show its first version, missing context, challenge, and reusable handoff before the developer treats test case table with edge conditions as finished. Approval for developers unit tests belongs with the accountable reviewer before the answer reaches a code reviewer, teammate, maintainer, or future self; keep the test case table with edge conditions review standard visible.

  1. First run

    Use this first when the source note is messy but concrete enough to produce a reviewable unit test cases.

    Write Unit Tests first run: use the rough note "Need test cases, names, assertions, and edge cases. Existing tests use Vitest. Avoid testing implementation details." from A developer added a function that normalizes search filters and needs tests for empty input, multiple filters, and URL parameter order.; build unit test cases as a technical checklist with hypotheses, steps, risks, and verification commands; rely on supplied facts for the main answer, label assumptions, keep edge cases, assertions, fixtures, failure mode, and existing test style visible, and end with the support still needed for actual error output, code behavior, and passing verification.
    Keep
    Keep the exact source note, the requested output shape, and any line that directly supports edge cases, assertions, fixtures, failure mode, and existing test style.
    Accept if
    Accept the first answer only if it separates source-backed details from assumptions and gives the reviewer accountable for unit test cases quality, edge cases and assertions, and codebase verification something concrete to inspect.
    Stop if
    Stop if the answer invents missing context, treats actual error output, code behavior, and passing verification as proven, or drifts into general write unit tests advice.
  2. Gap fill

    Use this after the first answer when the shape is useful but the model skipped questions that block real use.

    Write Unit Tests gap fill: compare the first answer with the rough note already in this thread; name the missing inputs that prevent a code reviewer, teammate, maintainer, or future self from using the result; ask up to five questions grouped by audience, source support, channel, reviewer, and reuse field, then say which part can continue with a safe fallback.
    Keep
    Keep any section that maps to function behavior, edge cases, inputs, outputs, and existing test style; move guesses into open questions instead of deleting the whole answer.
    Accept if
    Accept this turn only if the missing questions would help a developer make a clearer choice before rerunning or revising.
    Stop if
    Stop if the model asks generic questions that do not affect a technical checklist with hypotheses, steps, risks, and verification commands, unit test cases quality, edge cases and assertions, and codebase verification, or the final handoff.
  3. Skeptic pass

    Use this before sharing the answer, especially when it sounds polished enough to hide weak evidence.

    Write Unit Tests skeptic pass: compare the current answer with the rough note already in this thread; mark unsupported claims, unclear owners, privacy issues, and weak spots around actual error output, code behavior, and passing verification; give each issue a repair sentence that keeps edge cases, assertions, fixtures, failure mode, and existing test style visible without adding new facts.
    Keep
    Keep the usable structure from the first answer, but require every claim and recommendation to survive the skeptic pass.
    Accept if
    Accept this turn only if it gives repair instructions that the reviewer accountable for unit test cases quality, edge cases and assertions, and codebase verification can apply without rewriting the whole asset from scratch.
    Stop if
    Stop if the critique only says the answer is good or bad without naming the exact line, risk, and repair move.
  4. Handoff

    Use this after the answer survives the gap fill and skeptic pass and is ready to become a working asset.

    Write Unit Tests handoff: prepare the accepted unit test cases, a needs-checking block for actual error output, code behavior, and passing verification, a reviewer note for the reviewer accountable for unit test cases quality, edge cases and assertions, and codebase verification, and a reusable version with variables for source notes, audience, output format, support need, stop rule, and edge cases, assertions, fixtures, failure mode, and existing test style; remove one-time private details before saving.
    Keep
    Keep the accepted wording, the repair choices, and the variables that make unit tests prompt pattern with source notes, constraints, and review checklist safe to rerun.
    Accept if
    Accept the handoff only if a code reviewer, teammate, maintainer, or future self can tell what is ready, what needs review, and what must be replaced next time.
    Stop if
    Stop if the final version saves polished case details instead of a reusable prompt structure with visible boundaries.

Prompt readiness check before you copy

Use this quick pass to decide whether to collect more context, build a context pack, or run the prompt and grade the answer.

0/6 ready
Do next

Collect context first

The prompt can run, but the answer will likely fill gaps with assumptions. Start by collecting notes, constraints, and the person who will check it.

Use this prompt when
Developers who have real notes or context and need a structured first version of unit test cases.
Wait if
Reject the answer if it invents facts, numbers, policy claims, citations, credentials, or examples that were not in the notes.
Who checks it
Write Unit Tests review starts with source support, with actual error output, code behavior, and passing verification and edge cases, assertions, fixtures, failure mode, and existing test style as the two hard checks.
Reuse rule
Reuse unit tests only after private details are removed, one-time facts become variables, add missing edge cases and remove tests that only mirror the implementation, and the review rule for edge cases, assertions, fixtures, failure mode, and existing test style still appears in the reusable prompt. Approval for developers unit tests belongs with the accountable reviewer before the answer reaches a code reviewer, teammate, maintainer, or future self; keep the test case table with edge conditions review standard visible.

Session handoff: finish the run without losing the thread

Track the four steps that turn a copied prompt into a usable work session.

0/4 steps
Next action

Collect working context

Start by getting source notes, constraints, the person who checks it, and the stop rule into one place.

Working note
Need test cases, names, assertions, and edge cases. Existing tests use Vitest. Avoid testing implementation details. Phrase shopping fails for unit test cases work because the note should become test case table with edge conditions. The user's note should stay readable after the answer is organized. This unit test cases work run should turn that note into unit test cases. For unit test cases work, paste the source as bullets, constraints, and audience notes so the model has enough shape for a technical checklist with hypotheses, steps, risks, and verification commands.
Who checks it
Write Unit Tests review starts with source support, with actual error output, code behavior, and passing verification and edge cases, assertions, fixtures, failure mode, and existing test style as the two hard checks.
Stop rule
Reject the answer if it invents facts, numbers, policy claims, citations, credentials, or examples that were not in the notes.
Reuse choice
Reuse unit tests only after private details are removed, one-time facts become variables, add missing edge cases and remove tests that only mirror the implementation, and the review rule for edge cases, assertions, fixtures, failure mode, and existing test style still appears in the reusable prompt. Approval for developers unit tests belongs with the accountable reviewer before the answer reaches a code reviewer, teammate, maintainer, or future self; keep the test case table with edge conditions review standard visible.

Work note: what the rough note changes

Use this when the answer must carry the original note, the missing context, and the review check into the final prompt run.

Original working note

A rough unit tests note comes in: "Need test cases, names, assertions, and edge cases. Existing tests use Vitest. Avoid testing implementation details." is the rough request. Before reusing unit tests, the usable version reads as unit test cases, keeps edge cases, assertions, fixtures, failure mode, and existing test style visible, names the checker, and protects this boundary: verify against the actual codebase and test results before using.

Received note
Received note for Developers Write Unit Tests: "Need test cases, names, assertions, and edge cases. Existing tests use Vitest. Avoid testing implementation details." arrives as the source note inside an engineering workflow where context, tests, and reproducibility matter, with The prompt should ask for behavior, inputs, outputs, and existing test style before writing test cases. as the first human concern and test case table with edge conditions as the target artifact.
Question before run
Before the first run, ask which part of "Need test cases, names, assertions, and edge cases. Existing tests use Vitest. Avoid testing implementation details." is fixed source material and which part is only preference, guesswork, or a missing approval point for the person who will approve unit test cases.
First answer flaw
First answer flaw for Developers Write Unit Tests: the first answer may sound polished while it drops the rough-note constraint, skips the reviewer, and turns actual error output, code behavior, and passing verification into an implied claim instead of a checkable line.
Human edit
Human edit for Developers Write Unit Tests: rewrite the answer so each useful section names what came from the note, what still needs actual error output, code behavior, and passing verification, and where the person who will approve unit test cases should stop before sharing it; the editor also has to add missing edge cases and remove tests that only mirror the implementation; the edit has to preserve "Need test cases, names, assertions, and edge cases. Existing tests use Vitest. Avoid testing implementation details." and leave test case table with edge conditions ready for a reviewer, not just prettier.
Reusable field
Reusable field for Developers Write Unit Tests: save the reusable fields as source note, audience, output shape, reviewer, stop rule, and edge cases, assertions, fixtures, failure mode, and existing test style; do not save private details or one-time facts as fixed wording. Keep the field set alert to this repeat risk: test suggestions can cover the happy path while missing the edge condition that caused the risk.

Questions before reuse

  • Unit Tests reader check: who will read or approve this unit test cases, and what do they already know?
  • Unit Tests source sort: which lines in the rough note are facts, preferences, constraints, or open questions?
  • Unit Tests blank rule: what should stay blank or flagged if actual error output, code behavior, and passing verification is missing?

Who checks it

Write Unit Tests review starts with source support, with actual error output, code behavior, and passing verification and edge cases, assertions, fixtures, failure mode, and existing test style as the two hard checks.

  • Unit Tests source note: treat "Need test cases, names, assertions, and edge cases. Existing tests use Vitest. Avoid testing implementation details." as the factual base, not decorative background; the next usable asset is test case table with edge conditions.
  • Unit Tests evidence check: mark any section where actual error output, code behavior, and passing verification is assumed instead of shown, especially when test suggestions can cover the happy path while missing the edge condition that caused the risk.
  • Unit Tests scope check: keep the answer on edge cases, assertions, fixtures, failure mode, and existing test style; do not drift away from an engineering workflow where context, tests, and reproducibility matter.
  • Unit Tests final polish: rewrite final wording only after unit test cases quality, edge cases and assertions, and codebase verification is clear enough for the code reviewer, teammate, maintainer, or future self owner, then add missing edge cases and remove tests that only mirror the implementation.
  • Unit Tests freshness rule: Unit test freshness check: recheck the latest behavior, changed files, and failing edge case before saving a test plan.

Usable output

A usable unit tests handoff would return unit test cases with named sections, action bullets, and a final reviewer pass; split the user's pasted facts from anything ChatGPT inferred, put the reviewer beside the section they must approve, prepare test case table with edge conditions, and center the last read on unit test cases quality, edge cases and assertions, and codebase verification.

Save this noteRough note that changes the prompt: Need test cases, names, assertions, and edge cases. Existing tests use Vitest. Avoid testing implementation details. Task-specific source material: function behavior, edge cases, inputs, outputs, and existing test style Human check to keep visible: unit test cases quality, edge cases and assertions, and codebase verification
Stop hereReject the answer if it invents facts, numbers, policy claims, citations, credentials, or examples that were not in the notes.
Save for reuseReuse unit tests only after private details are removed, one-time facts become variables, add missing edge cases and remove tests that only mirror the implementation, and the review rule for edge cases, assertions, fixtures, failure mode, and existing test style still appears in the reusable prompt. Approval for developers unit tests belongs with the accountable reviewer before the answer reaches a code reviewer, teammate, maintainer, or future self; keep the test case table with edge conditions review standard visible.

Prompt run from pasted notes

Use this pass to see what should happen between the rough note and the answer that is safe enough to review.

Pasted notes

Developers bring unit test cases work source notes: A developer added a function that normalizes search filters and needs tests for empty input, multiple filters, and URL parameter order. The source says "Need test cases, names, assertions, and edge cases. Existing tests use Vitest. Avoid testing implementation details." The answer needs to become test case table with edge conditions for a code reviewer, teammate, maintainer, or future self; the run lives in an engineering workflow where context, tests, and reproducibility matter and has to respect this rule before any wording polish: The prompt should ask for behavior, inputs, outputs, and existing test style before writing test cases.

Why this input is messy

This unit test cases work input needs care because the note carries facts, preferences, limits, and open approval points in one line; a quick answer can smooth over actual error output, code behavior, and passing verification, miss edge cases, assertions, fixtures, failure mode, and existing test style, or make unit test cases look ready before the person approving unit test cases checks it, especially when test suggestions can cover the happy path while missing the edge condition that caused the risk.

First prompt move

developer should start the unit test cases work run by asking ChatGPT to ask ChatGPT to restate the source notes in three buckets before writing: facts it can use, assumptions it must not hide, and missing points that affect actual error output, code behavior, and passing verification; this is a context pass before polish because a technical checklist with hypotheses, steps, risks, and verification commands has to stay traceable to the original note.

Questions ChatGPT should ask

  1. Reader detail in unit test cases work: who will read this unit test cases, and what do they already know?
  2. Source detail in unit test cases work: which note details are verified facts, and which parts still need actual error output, code behavior, and passing verification?
  3. Constraint detail in unit test cases work: what tone, length, channel, or approval rule matters before the answer reaches a code reviewer, teammate, maintainer, or future self?
  4. Reuse detail in unit test cases work: which person will inspect unit test cases quality, edge cases and assertions, and codebase verification, and what would make the answer unsafe to reuse?

Usable answer shape

The unit test cases work answer should return a technical checklist with hypotheses, steps, risks, and verification commands, separate source-backed sections from assumptions and open questions, show how edge cases, assertions, fixtures, failure mode, and existing test style shaped the result, name the person approving unit test cases, and end with a short check for unit test cases quality, edge cases and assertions, and codebase verification before the answer is shared or saved.

Human revision

developer should revise the unit test cases work answer by keeping the parts that saved review time, add missing edge cases and remove tests that only mirror the implementation, replace private or one-off details with reusable fields, and shape the closing version for a code reviewer, teammate, maintainer, or future self; check it against "Need test cases, names, assertions, and edge cases. Existing tests use Vitest. Avoid testing implementation details." and keep this final standard visible: the developer review should check that tests fail for the right reason, avoid over-mocking, and cover the edge cases users can trigger.

Save or discard

Save the unit test cases work run only when the note, output shape, checker, test case table with edge conditions, and reuse rule stay visible; rerun or discard the answer when it could fit another developer task without changing the source notes, or when actual error output, code behavior, and passing verification is implied but not checkable.

Choose the right workflow for this job

Work moment

The page is for the moment when developers have enough notes to create unit test cases, but still need a choice about edge cases, assertions, fixtures, failure mode, and existing test style.

Why this workflow

This workflow earns its own place because the source has to become unit test cases, and the acceptance test is whether a code reviewer, teammate, maintainer, or future self can use it without guessing the missing pieces.

Do first

Start by pasting the rough note, then replace the variables that control audience, source material, and the reviewer for unit test cases quality, edge cases and assertions, and codebase verification.

Next best workflow

ChatGPT Prompts for DevelopersReturn to the role guide to choose by situation, output, and reviewer.

What to look for

  • Rough note that changes the prompt: Need test cases, names, assertions, and edge cases. Existing tests use Vitest. Avoid testing implementation details.
  • Task-specific source material: function behavior, edge cases, inputs, outputs, and existing test style
  • Human check to keep visible: unit test cases quality, edge cases and assertions, and codebase verification
  • Evidence pressure point: actual error output, code behavior, and passing verification

Wrong page if

  • The user cannot provide function behavior, edge cases, inputs, outputs, and existing test style and would need ChatGPT to invent the important facts.
  • The desired result is not unit test cases or cannot be shaped as a technical checklist with hypotheses, steps, risks, and verification commands.
  • The task would be safer on ChatGPT Prompts for Developers because the main choice is closer to that workflow.

When workflows look similar

Use this when the page looks close, but the thing you need to make or the person checking it is different.

Debug an issue
Use this workflow

Stay with ChatGPT Prompts for Developers to Write Unit Tests when your notes already include this check: Task-specific source material: function behavior, edge cases, inputs, outputs, and existing test style.

Switch instead

Switch to Debug an issue when the thing you need to make or the person checking it matches that workflow: Useful next step when this workflow needs a related developers output or review pass.

Keep separate

Keep the pages separate if The user cannot provide function behavior, edge cases, inputs, outputs, and existing test style and would need ChatGPT to invent the important facts.

Review code
Use this workflow

Stay with ChatGPT Prompts for Developers to Write Unit Tests when your notes already include this check: Human check to keep visible: unit test cases quality, edge cases and assertions, and codebase verification.

Switch instead

Switch to Review code when the thing you need to make or the person checking it matches that workflow: Useful next step when this workflow needs a related developers output or review pass.

Keep separate

Keep the pages separate if The desired result is not unit test cases or cannot be shaped as a technical checklist with hypotheses, steps, risks, and verification commands.

Write documentation
Use this workflow

Stay with ChatGPT Prompts for Developers to Write Unit Tests when your notes already include this check: Evidence pressure point: actual error output, code behavior, and passing verification.

Switch instead

Switch to Write documentation when the thing you need to make or the person checking it matches that workflow: Useful next step when this workflow needs a related developers output or review pass.

Keep separate

Keep the pages separate if The task would be safer on ChatGPT Prompts for Developers because the main choice is closer to that workflow.

Run the page by work state

Start by turning the rough request into named fields before asking for unit test cases.

Build The Asset

Use this when the notes are ready and the next useful output is a technical checklist with hypotheses, steps, risks, and verification commands, not more brainstorming.

Open section
Do now
Copy the recommended prompt, replace the variables, and ask for unit test cases with assumptions separated from source-backed details.
Bring
Bring the task focus: edge cases, assertions, fixtures, failure mode, and existing test style. Add the channel, deadline, and any required sections.
Stop if
Stop if the first answer gives broad advice instead of a concrete unit test cases.
Next check
Use the run sheet's review mode before sharing anything with a code reviewer, teammate, maintainer, or future self.

Bring this

Bring function behavior, edge cases, inputs, outputs, and existing test style; add the reviewer, the audience, and the boundary from this case: The prompt should ask for behavior, inputs, outputs, and existing test style before writing test cases.

Reusable handoff

A usable handoff is a technical checklist with hypotheses, steps, risks, and verification commands with assumptions, source-backed sections, and a reviewer note for unit test cases quality, edge cases and assertions, and codebase verification.

Reality checks

  • Does the page-specific note "Need test cases, names, assertions, and edge cases. Existing tests use Vitest. Avoid testing implementation details." change the prompt, or could this still fit another task unchanged?
  • Can the reviewer check unit test cases quality, edge cases and assertions, and codebase verification without asking ChatGPT to invent missing facts?
  • Does the answer become unit test cases, or does it stay at broad unit test cases work advice?
  • Would a code reviewer, teammate, maintainer, or future self know what was provided, what was assumed, and what still needs review?

Prompt path by where the work is stuck

advanced

Write unit tests for developer Evidence-Aware Working Copy Prompt

Use this when the source material is ready and the answer needs to become unit test cases.

Use this when
Use before asking ChatGPT for unit test cases work so the model has enough task-specific context.
When this fits
Turn function behavior, edge cases, inputs, outputs, and existing test style into unit test cases for a code reviewer, teammate, maintainer, or future self.
Do next
Compare the answer against the original notes and mark every line that depends on actual error output, code behavior, and passing verification.
Open this prompt card

Context pack before copying

0/8
Ready to paste

Context brief for the next prompt

Context pack for Developers to Write Unit Tests

Goal: Find a copyable prompt workbench that helps developers with unit test cases work, using the right source material, review lens, example, and follow-up prompts.
Working scenario: A developer added a function that normalizes search filters and needs tests for empty input, multiple filters, and URL parameter order. The unit test cases work happens inside an engineering workflow where context, tests, and reproducibility matter. Unit test freshness check: recheck the latest behavior, changed files, and failing edge case before saving a test plan. Approval for developers unit tests belongs with the accountable reviewer before the answer reaches a code reviewer, teammate, maintainer, or future self; keep the test case table with edge conditions review standard visible. For unit test cases work, those constraints decide what the answer is allowed to do; without them, ChatGPT can sound finished while skipping the detail a developer checks first.

What I know:
Need test cases, names, assertions, and edge cases. Existing tests use Vitest. Avoid testing implementation details. Phrase shopping fails for unit test cases work because the note should become test case table with edge conditions. The user's note should stay readable after the answer is organized. This unit test cases work run should turn that note into unit test cases. For unit test cases work, paste the source as bullets, constraints, and audience notes so the model has enough shape for a technical checklist with hypotheses, steps, risks, and verification commands.

Constraints and no-go rules:
AI-assisted code must be reviewed, tested, and adapted to the actual codebase. Ask ChatGPT to label assumptions and verification needs before using unit test cases. Do not paste private names, identifiers, account details, student records, customer records, or confidential strategy when a summarized version is enough.

Who checks it:
Write Unit Tests review starts with source support, with actual error output, code behavior, and passing verification and edge cases, assertions, fixtures, failure mode, and existing test style as the two hard checks.

Readiness checks:
- [ ] Source notes are available
- [ ] Audience or recipient is named
- [ ] Constraints are explicit
- [ ] Facts to verify are listed
- [ ] Checker is named

Ask ChatGPT to request missing context before writing. Keep assumptions separate from source-based claims.
Ask first

Questions to ask before the next run

5 questions
  • What source note should the answer use for Developers to Write Unit Tests?
  • Who will read or use the final answer?
  • Which limits must stay visible, especially ai-assisted code must be reviewed, tested, and adapted to the actual codebase.?
  • Which facts should be checked before accepting the answer for ChatGPT Prompts for Developers to Write Unit Tests?
  • Who should check the answer before it is reused: Write Unit Tests review starts with source support, with actual error output, code behavior, and passing verification and edge cases, assertions, fixtures, failure mode, and existing test style as the two hard checks.?

Output grader before reuse

0/5

0 words checked against Write Unit Tests review starts with source support, with actual error output, code behavior, and passing verification and edge cases, assertions, fixtures, failure mode, and existing test style as the two hard checks.

Needs another review pass

unit test cases final pass: keep the useful structure, then add missing edge cases and remove tests that only mirror the implementation; readiness means a code reviewer, teammate, maintainer, or future self can see what was provided, what was assumed, why test suggestions can cover the happy path while missing the edge condition that caused the risk, and what still needs review.

Task-specific output diagnosis

Paste the first Write Unit Tests answer and compare it with "Need test cases, names, assertions, and edge cases. Existing tests use Vitest. Avoid testing implementation details." before checking style. A useful developer output must prove it belongs to this page by keeping edge cases, assertions, fixtures, failure mode, and existing test style, a technical checklist with hypotheses, steps, risks, and verification commands, and the task reviewer visible.

Pass when

  • The answer uses "Need test cases, names, assertions, and edge cases. Existing tests use Vitest. Avoid testing implementation details." as the controlling case, not as decoration, and turns it into a technical checklist with hypotheses, steps, risks, and verification commands with edge cases, assertions, fixtures, failure mode, and existing test style still visible.
  • The answer shows which lines come from "Need test cases, names, assertions, and edge cases. Existing tests use Vitest. Avoid testing implementation details." and which lines remain assumptions before a code reviewer, teammate, maintainer, or future self sees the unit test cases.
  • The answer gives the task reviewer a clear check tied to "Need test cases, names, assertions, and edge cases. Existing tests use Vitest. Avoid testing implementation details.", especially the point where actual error output, code behavior, and passing verification cannot be treated as proven.
  • The answer can become unit tests prompt pattern with source notes, constraints, and review checklist only after the one-time facts in "Need test cases, names, assertions, and edge cases. Existing tests use Vitest. Avoid testing implementation details." are replaced with variables and the stop rule stays attached.

False pass

  • It sounds polished but never quotes or preserves the specific case in "Need test cases, names, assertions, and edge cases. Existing tests use Vitest. Avoid testing implementation details.", so the write unit tests output could fit another page.
  • It gives a generic next step while hiding edge cases, assertions, fixtures, failure mode, and existing test style, which makes the answer feel useful before it can support the real unit test cases.
  • It skips the task reviewer or buries the review check, so the user cannot tell who should approve the answer before reuse.
  • It could fit a neighboring workflow because the response hides a technical checklist with hypotheses, steps, risks, and verification commands, actual error output, code behavior, and passing verification, or the source material that makes this write unit tests page different.

Repair next

  • Rewrite the opening around "Need test cases, names, assertions, and edge cases. Existing tests use Vitest. Avoid testing implementation details." and keep the first sentence tied to edge cases, assertions, fixtures, failure mode, and existing test style before improving tone or length.
  • Add a needs-checking block for actual error output, code behavior, and passing verification, then separate supplied facts from assumptions before returning a technical checklist with hypotheses, steps, risks, and verification commands.
  • Mark the line the task reviewer must inspect for unit test cases quality, edge cases and assertions, and codebase verification, and move unsupported claims out of the usable answer.
  • Replace one-time details with variables for the saved unit tests prompt pattern with source notes, constraints, and review checklist, then rerun only the section that failed the write unit tests check.

Red flags

  • Evidence issue, write unit tests: the answer invents or overstates actual error output, code behavior, and passing verification.
  • Task drift, write unit tests: it ignores edge cases, assertions, fixtures, failure mode, and existing test style and moves into a neighboring workflow.
  • Readiness gap, write unit tests: it sounds complete while leaving unit test cases quality, edge cases and assertions, and codebase verification impossible to verify.
  • Privacy issue, write unit tests: it includes details that should have been summarized or removed.
  • Generic output, write unit tests: it produces a broad template that could fit any task in the role.

Choose the next pass

Pick what happens to this answer before it becomes a saved version.

Repair

Repair next

Run a narrower pass against the failed line, the source note, and the task-specific stop rule.

  • Rewrite the opening around "Need test cases, names, assertions, and edge cases. Existing tests use Vitest. Avoid testing implementation details." and keep the first sentence tied to edge cases, assertions, fixtures, failure mode, and existing test style before improving tone or length.
  • Add a needs-checking block for actual error output, code behavior, and passing verification, then separate supplied facts from assumptions before returning a technical checklist with hypotheses, steps, risks, and verification commands.

Repair pass

Output next pass for: Write Unit Tests: review unit test cases
Next pass: Repair
Why: Run a narrower pass against the failed line, the source note, and the task-specific stop rule.
Checked items: 0/5
Issue note: Add the failed line or remaining risk before copying this pass.

Source task:
Find a copyable prompt workbench that helps developers with unit test cases work, using the right source material, review lens, example, and follow-up prompts.

Repair moves:
- Rewrite the opening around "Need test cases, names, assertions, and edge cases. Existing tests use Vitest. Avoid testing implementation details." and keep the first sentence tied to edge cases, assertions, fixtures, failure mode, and existing test style before improving tone or length.
- Add a needs-checking block for actual error output, code behavior, and passing verification, then separate supplied facts from assumptions before returning a technical checklist with hypotheses, steps, risks, and verification commands.
- Mark the line the task reviewer must inspect for unit test cases quality, edge cases and assertions, and codebase verification, and move unsupported claims out of the usable answer.
- Replace one-time details with variables for the saved unit tests prompt pattern with source notes, constraints, and review checklist, then rerun only the section that failed the write unit tests check.

Keep if repaired:
- The answer uses "Need test cases, names, assertions, and edge cases. Existing tests use Vitest. Avoid testing implementation details." as the controlling case, not as decoration, and turns it into a technical checklist with hypotheses, steps, risks, and verification commands with edge cases, assertions, fixtures, failure mode, and existing test style still visible.
- The answer shows which lines come from "Need test cases, names, assertions, and edge cases. Existing tests use Vitest. Avoid testing implementation details." and which lines remain assumptions before a code reviewer, teammate, maintainer, or future self sees the unit test cases.

Answer being graded:
Paste the ChatGPT answer above before copying this pass.

Return the smallest revised answer, the line a person must check, and whether this should be accepted, repaired again, or rejected.

Answer repair for replies that sound right but are not ready

Weak answer pattern

A rushed Developers Write Unit Tests pass copies a line like "Here is a polished version based on your notes It covers the main points, keeps a professional tone, and adds a useful next step" and then moves on. Write Unit Tests failure to avoid for developer: it also leaves no place for assumptions, missing facts, or a reviewer note; the actual note to protect is Need test cases, names, assertions, and edge cases. Existing tests use Vitest. Avoid testing implementation details.

Why it fails

Write Unit Tests repair note: the answer looks confident because it uses smooth wording, but it never proves where the key claims came from Restore edge cases, assertions, fixtures, failure mode, and existing test style at the top of the second pass; label the lines that rely on actual error output, code behavior, and passing verification, name the person approving unit test cases before sharing with a code reviewer, teammate, maintainer, or future self, and solve the practical snag: test suggestions can cover the happy path while missing the edge condition that caused the risk.

Trace the rough note

Problem
The answer mentions unit test cases but does not reflect the concrete case: A developer added a function that normalizes search filters and needs tests for empty input, multiple filters, and URL parameter order.
Repair
Rewrite the first section around the user note, then mark which details came from the note, which details still need confirmation, and where test case table with edge conditions changes the output.

Name the reviewer

Problem
The answer can move forward without anyone checking unit test cases quality, edge cases and assertions, and codebase verification.
Repair
Add a reviewer line for the person approving unit test cases, plus one question that must be answered before the result is shared.

Protect the evidence

Problem
The answer can imply actual error output, code behavior, and passing verification even when the source notes do not support it.
Repair
Keep unsupported claims in a separate needs-checking block and remove any claim the user cannot verify.

Keep the task narrow

Problem
The response can drift from write unit tests into broad advice that does not produce a technical checklist with hypotheses, steps, risks, and verification commands.
Repair
Force the final answer back into a technical checklist with hypotheses, steps, risks, and verification commands, keep edge cases, assertions, fixtures, failure mode, and existing test style as the main choice point, and add missing edge cases and remove tests that only mirror the implementation.

Human-edited direction

Human Write Unit Tests revision for Developers: start with the actual case, name the audience, return a technical checklist with hypotheses, steps, risks, and verification commands, keep supplied notes, assumptions, and missing checks separate, then add missing edge cases and remove tests that only mirror the implementation, tell a code reviewer, teammate, maintainer, or future self what is ready to use, what the person approving unit test cases must verify, and how the answer becomes unit tests prompt pattern with source notes, constraints, and review checklist without private or one-time details.

Rerun prompt

Rerun Developers Write Unit Tests: repair this write unit tests answer, keep the result focused on edge cases, assertions, fixtures, failure mode, and existing test style, return a technical checklist with hypotheses, steps, risks, and verification commands, put unsupported claims about actual error output, code behavior, and passing verification in a needs-checking block, name the reviewer as the person approving unit test cases, protect this boundary "verify against the actual codebase and test results before using", and use only these source notes: Need test cases, names, assertions, and edge cases. Existing tests use Vitest. Avoid testing implementation details.

Accept when

  • The answer visibly uses the rough note instead of generic write unit tests advice.
  • The result is shaped as a technical checklist with hypotheses, steps, risks, and verification commands and can be checked by the person approving unit test cases.
  • Any uncertain point about actual error output, code behavior, and passing verification is separated from the usable parts.
  • The reusable version keeps edge cases, assertions, fixtures, failure mode, and existing test style and removes one-time or private details.

Reject when

  • The answer could fit another developer task without changing more than the title.
  • The response sounds polished but cannot show where the key claims came from.
  • The result skips unit test cases quality, edge cases and assertions, and codebase verification or hides who should approve it.
  • The answer asks the user to trust the model instead of checking the source notes.

Start from the user's actual notes

Reader situation

Developers want tests that reflect behavior and edge cases in the existing style, not brittle mock-heavy examples. This page is for developers unit test cases work when test suggestions can cover the happy path while missing the edge condition that caused the risk. Unit test search results edge: this page should win only if it maps behavior, edge cases, fixtures, and review checks instead of listing test-writing prompts. Outside support for unit tests with developers: an independent resource must mention the unit test cases page visibly before test case table with edge conditions becomes an authority claim. Unit test cases work for developer needs its own page because a useful visit starts when the prompt reflects function behavior, edge cases, inputs, outputs, and existing test style, the actual test case table with edge conditions, and the review choice that follows the answer.

Concrete scenario

A developer added a function that normalizes search filters and needs tests for empty input, multiple filters, and URL parameter order. The unit test cases work happens inside an engineering workflow where context, tests, and reproducibility matter. Unit test freshness check: recheck the latest behavior, changed files, and failing edge case before saving a test plan. Approval for developers unit tests belongs with the accountable reviewer before the answer reaches a code reviewer, teammate, maintainer, or future self; keep the test case table with edge conditions review standard visible. For unit test cases work, those constraints decide what the answer is allowed to do; without them, ChatGPT can sound finished while skipping the detail a developer checks first.

Real user input

Need test cases, names, assertions, and edge cases. Existing tests use Vitest. Avoid testing implementation details. Phrase shopping fails for unit test cases work because the note should become test case table with edge conditions. The user's note should stay readable after the answer is organized. This unit test cases work run should turn that note into unit test cases. For unit test cases work, paste the source as bullets, constraints, and audience notes so the model has enough shape for a technical checklist with hypotheses, steps, risks, and verification commands.

Editor take

The prompt should ask for behavior, inputs, outputs, and existing test style before writing test cases. In this unit test cases review, the edit is to add missing edge cases and remove tests that only mirror the implementation. Unit test failure sample: the answer writes happy-path tests that mirror the implementation and miss the edge case that created the risk. In the unit test cases work review, the editor should reward prompts that make actual error output, code behavior, and passing verification visible and penalize answers that hide missing context behind fluent wording; compare the answer with the actual notes before reuse.

Human polish

The developer review should check that tests fail for the right reason, avoid over-mocking, and cover the edge cases users can trigger. Approval for developers unit tests belongs with the accountable reviewer before the answer reaches a code reviewer, teammate, maintainer, or future self; keep the test case table with edge conditions review standard visible. Before handing off the unit test cases, the final human edit should keep the useful structure, remove unsupported details, add verified context, and check unit test cases quality, edge cases and assertions, and codebase verification before the output reaches a code reviewer, teammate, maintainer, or future self. Keep a short record of what changed before reuse. Recheck the latest behavior, changed files, and failing edge case before saving a test plan.

Fast use path

  1. Main card for unit test cases: copy the recommended prompt first, not every variation.
  2. Source material for unit test cases: replace [source_material] with function behavior, edge cases, inputs, outputs, and existing test style.
  3. Audience details for unit test cases: add the real audience and the constraint that matters most for unit test writing.
  4. Review pass for unit test cases: run the review prompt against unit test cases quality, edge cases and assertions, and codebase verification before using the answer.

Specificity signals

  • A developer added a function that normalizes search filters and needs tests for empty input, multiple filters, and URL parameter order.
  • Need test cases, names, assertions, and edge cases. Existing tests use Vitest. Avoid testing implementation details.
  • function behavior, edge cases, inputs, outputs, and existing test style
  • edge cases, assertions, fixtures, failure mode, and existing test style
  • actual error output, code behavior, and passing verification
  • verify against the actual codebase and test results before using
  • test case table with edge conditions
  • test suggestions can cover the happy path while missing the edge condition that caused the risk
  • add missing edge cases and remove tests that only mirror the implementation
  • an engineering workflow where context, tests, and reproducibility matter
  • Unit test freshness check: recheck the latest behavior, changed files, and failing edge case before saving a test plan.
  • Approval for developers unit tests belongs with the accountable reviewer before the answer reaches a code reviewer, teammate, maintainer, or future self; keep the test case table with edge conditions review standard visible.
  • Unit test search results edge: this page should win only if it maps behavior, edge cases, fixtures, and review checks instead of listing test-writing prompts.
  • Unit test failure sample: the answer writes happy-path tests that mirror the implementation and miss the edge case that created the risk.
  • Outside support for unit tests with developers: an independent resource must mention the unit test cases page visibly before test case table with edge conditions becomes an authority claim.

Real use sample: how the messy note changes the prompt

Messy brief

A rough unit tests note comes in: "Need test cases, names, assertions, and edge cases. Existing tests use Vitest. Avoid testing implementation details." is the rough request. Before reusing unit tests, the usable version reads as unit test cases, keeps edge cases, assertions, fixtures, failure mode, and existing test style visible, names the checker, and protects this boundary: verify against the actual codebase and test results before using.

Ask before copying

  • Unit Tests reader check: who will read or approve this unit test cases, and what do they already know?
  • Unit Tests source sort: which lines in the rough note are facts, preferences, constraints, or open questions?
  • Unit Tests blank rule: what should stay blank or flagged if actual error output, code behavior, and passing verification is missing?
  • Unit Tests stop signal: which visible mistake would stop the team from using the answer?

Checks before sharing

  • Unit Tests source note: treat "Need test cases, names, assertions, and edge cases. Existing tests use Vitest. Avoid testing implementation details." as the factual base, not decorative background; the next usable asset is test case table with edge conditions.
  • Unit Tests evidence check: mark any section where actual error output, code behavior, and passing verification is assumed instead of shown, especially when test suggestions can cover the happy path while missing the edge condition that caused the risk.
  • Unit Tests scope check: keep the answer on edge cases, assertions, fixtures, failure mode, and existing test style; do not drift away from an engineering workflow where context, tests, and reproducibility matter.
  • Unit Tests final polish: rewrite final wording only after unit test cases quality, edge cases and assertions, and codebase verification is clear enough for the code reviewer, teammate, maintainer, or future self owner, then add missing edge cases and remove tests that only mirror the implementation.
  • Unit Tests freshness rule: Unit test freshness check: recheck the latest behavior, changed files, and failing edge case before saving a test plan.
  • Unit Tests failure pattern: Unit test failure sample: the answer writes happy-path tests that mirror the implementation and miss the edge case that created the risk.
  • Unit Tests choice owner: Approval for developers unit tests belongs with the accountable reviewer before the answer reaches a code reviewer, teammate, maintainer, or future self; keep the test case table with edge conditions review standard visible.

Before and after

Weak answer risk
The weak unit tests answer risk is specific: the answer sounds complete while turning "need test cases, names, assertions, and edge cases; existing tests use vitest; avoid testing implementation details;" into broad advice, hiding missing context around actual error output, code behavior, and passing verification, and leaving a code reviewer, teammate, maintainer, or future self without a clear choice path because test suggestions can cover the happy path while missing the edge condition that caused the risk. Unit test failure sample: the answer writes happy-path tests that mirror the implementation and miss the edge case that created the risk.
Improved outcome
A usable unit tests handoff would return unit test cases with named sections, action bullets, and a final reviewer pass; split the user's pasted facts from anything ChatGPT inferred, put the reviewer beside the section they must approve, prepare test case table with edge conditions, and center the last read on unit test cases quality, edge cases and assertions, and codebase verification.
Why it feels real
The unit tests example feels grounded because: it starts from messy source notes, an engineering workflow where context, tests, and reproducibility matter, a named review moment, and task-level evidence instead of a clean prompt sentence. Unit test freshness check: recheck the latest behavior, changed files, and failing edge case before saving a test plan.

When to save this version

Reuse unit tests only after private details are removed, one-time facts become variables, add missing edge cases and remove tests that only mirror the implementation, and the review rule for edge cases, assertions, fixtures, failure mode, and existing test style still appears in the reusable prompt. Approval for developers unit tests belongs with the accountable reviewer before the answer reaches a code reviewer, teammate, maintainer, or future self; keep the test case table with edge conditions review standard visible.

The job this page helps finish

Searchers arrive with function behavior, edge cases, inputs, outputs, and existing test style already in hand and need help turning it into unit test cases. The page has to show the source fields, the output shape, and the point where a code reviewer, teammate, maintainer, or future self should stop and review. The distinct task pressure is edge cases, assertions, fixtures, failure mode, and existing test style.

Use Cases

  • Turn function behavior, edge cases, inputs, outputs, and existing test style into unit test cases for a code reviewer, teammate, maintainer, or future self.
  • Review an existing unit test cases work answer for unit test cases checkpoint, missing details, and unsupported claims.
  • Create a repeatable unit tests prompt pattern with source notes, constraints, and review checklist so the next version starts from stronger context.
  • Make edge cases, assertions, fixtures, failure mode, and existing test style visible so the answer stays tied to unit test cases instead of drifting into a neighboring task.
  • Condense a long ChatGPT answer into a technical checklist with hypotheses, steps, risks, and verification commands without losing the choices the human must make.

Input Prep

  • Write the audience or recipient in one sentence, including what they already know.
  • Paste or summarize function behavior, edge cases, inputs, outputs, and existing test style; do not ask the model to guess it.
  • Name the final choice the unit test cases work output must support.
  • Add constraints such as tone, length, required sections, privacy limits, and forbidden claims.
  • List the facts that must be checked after ChatGPT answers, especially actual error output, code behavior, and passing verification.
  • Add the task-specific focus: edge cases, assertions, fixtures, failure mode, and existing test style.

Check the answer against real references

What users are trying to finish

Searchers who land on unit tests want a prompt they can run against real material, usually function behavior, edge cases, inputs, outputs, and existing test style. They should leave knowing which fields to replace, which claims need review, and why edge cases, assertions, fixtures, failure mode, and existing test style changes the answer. This page has to connect function behavior, edge cases, inputs, outputs, and existing test style to unit test cases, show a technical checklist with hypotheses, steps, risks, and verification commands, and leave unit test cases quality, edge cases and assertions, and codebase verification with a named human reviewer.

Why the workflow matters

The page earns its place by pairing the recommended prompt with a filled case, a reject-if rule, and a repair prompt tied to edge cases, assertions, fixtures, failure mode, and existing test style. That gives the page a clearer job than a list of examples: it helps the user decide whether the answer is ready.

External references

Related ways people ask for this task

Question covered: chatgpt prompts for developers unit tests

What the reader wants: copy prompt workflow with template and review intent

Leave out popularity or ranking numbers until you can point to real search data after publishing.

Related ways people ask for this task

  • unit tests chatgpt prompt for developers
  • best chatgpt prompts for unit tests
  • unit tests prompt template for developers
  • copyable unit tests chatgpt prompt
  • unit tests ai prompt with review checklist
  • chatgpt unit tests workflow prompt

What to compare before using this prompt

  • Check whether ranking pages answer the task directly or only list broad prompts for developers.
  • Compare whether competitors show a filled example for unit test cases and not just a blank prompt.
  • Look for missing-source risks around actual error output, code behavior, and passing verification, especially claims that need manual checking.
  • Verify whether the search results favors a role hub, a task page, a template page, or a tool-like prompt builder.
  • Confirm no volume, ranking, CPC, or difficulty number is used unless it comes from a live keyword tool export.

Why this page should match the search

For "chatgpt prompts for developers unit tests", this page should win only if the reader can turn function behavior, edge cases, inputs, outputs, and existing test style into a technical checklist with hypotheses, steps, risks, and verification commands and still know who checks unit test cases.

Compare against

  • A broad developers prompt collection that gives short examples without a worked test case table with edge conditions.
  • A role guide that explains developers work but does not turn function behavior, edge cases, inputs, outputs, and existing test style into a technical checklist with hypotheses, steps, risks, and verification commands.
  • A prompt generator page that creates wording but leaves the unit test cases check to the user.
  • A task article that teaches write unit tests but does not give a copyable run with a check step.

This page is stronger when

  • It starts from function behavior, edge cases, inputs, outputs, and existing test style, then shapes the answer into a technical checklist with hypotheses, steps, risks, and verification commands instead of asking the reader to invent context.
  • It keeps the unit test cases check visible, so a smooth answer is not treated as ready before a person checks it.
  • It shows a weak-answer repair path for test suggestions can cover the happy path while missing the edge condition that caused the risk, which is the common failure a short example misses.
  • It links to nearby workflows when the user really needs a different output, owner, or source note.

Outside references to open

  • Open the official helpful-content guidance when you need to check whether the page is solving a real user task.
  • Open the role-specific outside reference when developers work needs policy, education, hiring, sales, marketing, developer, or operations context.
  • Keep source links beside the prompt output when actual error output, code behavior, and passing verification could change whether the answer is usable.

Improve the page when

  • Current search results mostly reward a different page type, such as a tool, forum thread, video, or role hub.
  • The top results answer a sharper question than "chatgpt prompts for developers unit tests" and this page does not yet answer that wording.
  • Readers cannot see test case table with edge conditions before they reach a long section of explanation.
  • The page starts getting visits for this topic but users would still need another page to check unit test cases.

Check the answer before you reuse it

Who checks it

Write Unit Tests review starts with source support, with actual error output, code behavior, and passing verification and edge cases, assertions, fixtures, failure mode, and existing test style as the two hard checks.

Real-world case

unit test cases scenario: a field-ready version should survive a messy paste where developers provide function behavior, edge cases, inputs, outputs, and existing test style, need a technical checklist with hypotheses, steps, risks, and verification commands, and must keep edge cases, assertions, fixtures, failure mode, and existing test style visible while checking actual error output, code behavior, and passing verification. For developers, write unit tests is reviewed inside an engineering workflow where context, tests, and reproducibility matter, with test case table with edge conditions as the concrete item on the desk.

Checks before sharing

  • Source review, write unit tests: the answer uses the supplied function behavior, edge cases, inputs, outputs, and existing test style and does not fill missing facts with confident guesses.
  • Output shape, write unit tests: the result clearly becomes unit test cases, not broad advice about the task.
  • Handoff clarity, write unit tests: the answer names missing inputs and the next human check for unit test cases quality, edge cases and assertions, and codebase verification.
  • Audience fit, write unit tests: the result works for a code reviewer, teammate, maintainer, or future self, including channel, tone, length, and choice context.
  • Risk boundary, write unit tests: the final version respects verify against the actual codebase and test results before using.

Compare with other results

Question to compare: chatgpt prompts for developers unit tests

  • Result unit tests developers check: open the top results and record whether they solve the task, not only a prompt phrase.
  • Example unit tests developers check: compare whether competing pages show a filled example for unit test cases using realistic function behavior, edge cases, inputs, outputs, and existing test style.
  • Evidence unit tests developers check: mark whether each page explains how to verify actual error output, code behavior, and passing verification and unit test cases quality, edge cases and assertions, and codebase verification.
  • Differentiator unit tests developers check: compare the top results against this page promise: Unit test search results edge: this page should win only if it maps behavior, edge cases, fixtures, and review checks instead of listing test-writing prompts.
  • Failure unit tests developers check: mark whether competing pages show this failure mode or avoid it: Unit test failure sample: the answer writes happy-path tests that mirror the implementation and miss the edge case that created the risk.
  • Freshness unit tests developers check: record whether competing pages say how source notes stay current. Unit test freshness check: recheck the latest behavior, changed files, and failing edge case before saving a test plan.
  • Page type unit tests developers check: confirm whether Google is rewarding a role hub, task page, tool, article, video, or forum thread for this query.
  • FAQ unit tests developers check: record People Also Ask questions that should become FAQ or section coverage before publishing changes.

Do not assume

  • Confirm the trust pages cite official Search Central guidance for helpful content and SEO basics.
  • Confirm source references support the safe-use and human-review framing.
  • Add or keep a role-specific external reference if developers need policy, education, developer, hiring, sales, or marketing context beyond this prompt library.
  • External support need: Outside support for unit tests with developers: an independent resource must mention the unit test cases page visibly before test case table with edge conditions becomes an authority claim.

Numbers to leave out unless verified

This page can prove local readiness, source coverage, and review depth. It cannot claim ranking, traffic, search volume, CPC, or difficulty until those numbers come from search performance tool or another real search data source after publishing.

Weak prompt: too vague to trust

Help me write unit tests for my work.

It gives no source material, no stakeholder, no output shape, and no review lens, so ChatGPT can fill gaps with generic advice.

Stronger prompt: specific enough to review

Help developers write unit tests by turning [source_material] into unit test cases for [audience]. Keep the task focus on edge cases, assertions, fixtures, failure mode, and existing test style. Use this output shape: a technical checklist with hypotheses, steps, risks, and verification commands. Do not add facts beyond the source. End with a review checklist for unit test cases quality, edge cases and assertions, and codebase verification and actual error output, code behavior, and passing verification.

It names the task asset, required inputs, audience, format, evidence boundary, and human review step, so the answer is easier to adapt and check.

Rewrite case from vague request to usable prompt

Original need

A developer added a function that normalizes search filters and needs tests for empty input, multiple filters, and URL parameter order. The user needs help with unit test cases, but the real job is to turn a messy request into unit test cases that a code reviewer, teammate, maintainer, or future self can review without hidden assumptions.

Weak prompt

Write a good unit test cases from this: Need test cases, names, assertions, and edge cases. Existing tests use Vitest. Avoid testing implementation details.

This weak version includes a real situation but gives ChatGPT no output shape, audience rule, evidence boundary, or review owner. It can sound polished while missing edge cases, assertions, fixtures, failure mode, and existing test style, inventing details, or skipping unit test cases quality, edge cases and assertions, and codebase verification.

Stronger prompt

Act as a careful assistant for Developers.
I need help with unit test cases. Use only this source material: Need test cases, names, assertions, and edge cases. Existing tests use Vitest. Avoid testing implementation details.
The usual source material for this task is function behavior, edge cases, inputs, outputs, and existing test style.
The audience is [audience], and the output must work for a code reviewer, teammate, maintainer, or future self.
Create unit test cases in this shape: a technical checklist with hypotheses, steps, risks, and verification commands.
Keep the task focus on edge cases, assertions, fixtures, failure mode, and existing test style.
Respect this editorial rule: The prompt should ask for behavior, inputs, outputs, and existing test style before writing test cases.
If context is missing, ask up to three clarifying questions before writing.
After the answer, include a review checklist for unit test cases quality, edge cases and assertions, and codebase verification, actual error output, code behavior, and passing verification, and this boundary: verify against the actual codebase and test results before using.

The stronger version gives ChatGPT a role, real input, audience, output shape, editorial boundary, and review lens. It also forces missing-context questions before creation and keeps actual error output, code behavior, and passing verification visible for human checking.

Sample input

A developer added a function that normalizes search filters and needs tests for empty input, multiple filters, and URL parameter order. User notes: Need test cases, names, assertions, and edge cases. Existing tests use Vitest. Avoid testing implementation details. Audience: a code reviewer, teammate, maintainer, or future self. Constraints: avoid unsupported claims, protect private details, and keep focus on edge cases, assertions, fixtures, failure mode, and existing test style.

Example answer shape

A useful answer starts by restating the real situation, then provides a technical checklist with hypotheses, steps, risks, and verification commands. It marks assumptions, shows which parts came from the user's notes, includes a concise next action, and ends with checks for unit test cases quality, edge cases and assertions, and codebase verification, actual error output, code behavior, and passing verification, and this boundary: verify against the actual codebase and test results before using. The output should already reflect the practical review target that matters here, so the developer review should check that tests fail for the right reason, avoid over-mocking, and cover the edge cases users can trigger.

Human-edited final version

The human keeps the structure, removes any unsupported claim, adds missing facts from the real source, and saves the prompt as a reusable unit tests prompt pattern with source notes, constraints, and review checklist. Before sharing with a code reviewer, teammate, maintainer, or future self, the final pass checks tone, privacy, evidence, and whether edge cases, assertions, fixtures, failure mode, and existing test style is still the center of the answer. The pass is accepted only when the developer review should check that tests fail for the right reason, avoid over-mocking, and cover the edge cases users can trigger.

Fit

  • Use when developers have real source notes for unit test cases.
  • Use when the desired result is unit test cases, not broad advice.
  • Use when a human can review unit test cases quality, edge cases and assertions, and codebase verification before the output reaches a code reviewer, teammate, maintainer, or future self.

Not fit

  • Do not use when the model is expected to invent facts, numbers, credentials, or private details.
  • Do not use when actual error output, code behavior, and passing verification is unavailable and cannot be checked.
  • Do not use as final judgment for sensitive outcomes covered by this boundary: verify against the actual codebase and test results before using.

Worked example: Write unit tests example from rough notes

Example input

A developer added a function that normalizes search filters and needs tests for empty input, multiple filters, and URL parameter order. Raw input: Need test cases, names, assertions, and edge cases. Existing tests use Vitest. Avoid testing implementation details.

Prompt use

Use the evidence-aware prompt to convert those notes into unit test cases, then run the review prompt against this editorial rule: The prompt should ask for behavior, inputs, outputs, and existing test style before writing test cases.

What the answer should look like

A useful answer would return a technical checklist with hypotheses, steps, risks, and verification commands for a code reviewer, teammate, maintainer, or future self, while making the source details and assumptions visible. It should preserve the real constraint in the input, keep edge cases, assertions, fixtures, failure mode, and existing test style at the center, and avoid adding facts that are not present. The final section should tell the user what still needs checking, especially actual error output, code behavior, and passing verification. The human pass is not decoration here: The developer review should check that tests fail for the right reason, avoid over-mocking, and cover the edge cases users can trigger.

Review notes

  • Confirm the answer reflects this actual situation: A developer added a function that normalizes search filters and needs tests for empty input, multiple filters, and URL parameter order.
  • Compare the output against the raw user input: Need test cases, names, assertions, and edge cases. Existing tests use Vitest. Avoid testing implementation details.
  • Confirm the source material really supports actual error output, code behavior, and passing verification.
  • Check that the wording fits a code reviewer, teammate, maintainer, or future self.
  • Confirm the answer handles edge cases, assertions, fixtures, failure mode, and existing test style instead of a neighboring task.
  • Remove details that violate this boundary: verify against the actual codebase and test results before using.

Build and check the prompt

advanced

Fill this prompt for the current run

Filled prompt preview
Run this evidence-aware working copy prompt for Developers; stay practical, cite the pasted notes, and leave the final call with the human reviewer.
Task: help me with unit test cases work. Target result: unit test cases.
Source material I can provide: function behavior, edge cases, inputs, outputs, and existing test style. Typical source for this task is function behavior, edge cases, inputs, outputs, and existing test style.
Audience or stakeholder: a code reviewer, teammate, maintainer, or future self. The output must work for a code reviewer, teammate, maintainer, or future self.
Task-specific focus to preserve: edge cases, assertions, fixtures, failure mode, and existing test style. If the pasted focus is broad, compare it with this page cue: edge cases, assertions, fixtures, failure mode, and existing test style.
Goal: make unit test cases easier to review, adapt, and use in a real developers workflow. Constraints: verify against the actual codebase and test results before using. Fact boundary for this run: keep actual error output, code behavior, and passing verification tied to function behavior, edge cases, inputs, outputs, and existing test style, and mark any detail the notes do not support.
Run mode for unit test cases work: Run this as the first usable version: use the supplied fields, label assumptions, and produce the main artifact.
Stop rule: Stop if the request asks you to invent facts, evidence, credentials, numbers, or private details.
Return a technical checklist with hypotheses, steps, risks, and verification commands.
Before writing unit test cases, ask up to 3 clarifying questions when function behavior, edge cases, inputs, outputs, and existing test style does not include function behavior, edge cases, inputs, outputs, and existing.
After the answer, include a human review section focused on unit test cases quality, edge cases and assertions, and codebase verification. Verify actual error output, code behavior, and passing verification; and respect this boundary: verify against the actual codebase and test results before using.
Check cue: for unit test cases work, The user should get a working version they can inspect against the supplied notes.
beginner

Write unit tests for developer Context Intake Prompt

Use this before unit test cases work when the notes are rough and ChatGPT should ask clarifying questions first.

Run this context intake prompt for Developers; stay practical, cite the pasted notes, and leave the final call with the human reviewer.
Task: help me with unit test cases work. Target result: unit test cases.
Source material I can provide: [source_material]. Typical source for this task is function behavior, edge cases, inputs, outputs, and existing test style.
Audience or stakeholder: [audience]. The output must work for a code reviewer, teammate, maintainer, or future self.
Task-specific focus to preserve: [task_focus]. If the pasted focus is broad, compare it with this page cue: edge cases, assertions, fixtures, failure mode, and existing test style.
Goal: [goal]. Constraints: [constraints]. Fact boundary for this run: keep actual error output, code behavior, and passing verification tied to [source_material], and mark any detail the notes do not support.
Run mode for unit test cases work: Run this as intake: ask the questions needed before writing, then wait for answers if the source material is missing.
Stop rule: Stop before creating the final asset if the audience, source material, or review owner is unclear.
Return a question list grouped by audience, source material, constraints, and review owner.
Before writing unit test cases, ask up to 3 clarifying questions when [source_material] does not include function behavior, edge cases, inputs, outputs, and existing.
After the answer, include a human review section focused on [review_lens]. Verify actual error output, code behavior, and passing verification; and respect this boundary: verify against the actual codebase and test results before using.
Check cue: for unit test cases work, The user should leave with a short context pack and a safe next prompt, not a finished answer.
[source_material]
Paste the concrete developer unit test cases work notes, such as function behavior, edge cases, inputs, outputs, and existing test style.Example: function behavior, edge cases, inputs, outputs, and existing test style
[audience]
Who will read, use, approve, or act on this developer unit test cases.Example: a code reviewer, teammate, maintainer, or future self
[goal]
The choice or work outcome this developer unit test cases work run should support.Example: make unit test cases easier to review, adapt, and use in a real developers workflow
[constraints]
Rules for developer unit test cases work: tone, length, channel, privacy, and actual error output, code behavior, and passing verification.Example: verify against the actual codebase and test results before using
[review_lens]
Use this check before sharing: unit test cases quality, edge cases and assertions, and codebase verification.Example: unit test cases quality, edge cases and assertions, and codebase verification
[task_focus]
The detail that keeps this developer unit test cases work prompt specific: edge cases, assertions, fixtures, failure mode, and existing test style.Example: edge cases, assertions, fixtures, failure mode, and existing test style

Expected output

Expect a question list grouped by audience, source material, constraints, and review owner that explicitly separates source-based content from assumptions and ends with a review pass for unit test cases quality, edge cases and assertions, and codebase verification.

Follow-up prompt

Now improve this working version into unit test cases by tightening unit test cases quality, edge cases and assertions, and codebase verification, emphasizing edge cases, assertions, fixtures, failure mode, and existing test style, removing unsupported claims, and giving me one stronger version for a code reviewer, teammate, maintainer, or future self.

Human review

Check whether the answer uses only provided context, handles actual error output, code behavior, and passing verification, fits a code reviewer, teammate, maintainer, or future self, reflects edge cases, assertions, fixtures, failure mode, and existing test style, and respects this boundary: verify against the actual codebase and test results before using.

Best for: Starting unit test cases work when the source material still needs shape. Use when: Use before asking ChatGPT for unit test cases work so the model has enough task-specific context.

advanced

Write unit tests for developer Evidence-Aware Working Copy Prompt

Use this when the source material is ready and the answer needs to become unit test cases.

Run this evidence-aware working copy prompt for Developers; stay practical, cite the pasted notes, and leave the final call with the human reviewer.
Task: help me with unit test cases work. Target result: unit test cases.
Source material I can provide: [source_material]. Typical source for this task is function behavior, edge cases, inputs, outputs, and existing test style.
Audience or stakeholder: [audience]. The output must work for a code reviewer, teammate, maintainer, or future self.
Task-specific focus to preserve: [task_focus]. If the pasted focus is broad, compare it with this page cue: edge cases, assertions, fixtures, failure mode, and existing test style.
Goal: [goal]. Constraints: [constraints]. Fact boundary for this run: keep actual error output, code behavior, and passing verification tied to [source_material], and mark any detail the notes do not support.
Run mode for unit test cases work: Run this as the first usable version: use the supplied fields, label assumptions, and produce the main artifact.
Stop rule: Stop if the request asks you to invent facts, evidence, credentials, numbers, or private details.
Return a technical checklist with hypotheses, steps, risks, and verification commands.
Before writing unit test cases, ask up to 3 clarifying questions when [source_material] does not include function behavior, edge cases, inputs, outputs, and existing.
After the answer, include a human review section focused on [review_lens]. Verify actual error output, code behavior, and passing verification; and respect this boundary: verify against the actual codebase and test results before using.
Check cue: for unit test cases work, The user should get a working version they can inspect against the supplied notes.
[source_material]
Paste the concrete developer unit test cases work notes, such as function behavior, edge cases, inputs, outputs, and existing test style.Example: function behavior, edge cases, inputs, outputs, and existing test style
[audience]
Who will read, use, approve, or act on this developer unit test cases.Example: a code reviewer, teammate, maintainer, or future self
[goal]
The choice or work outcome this developer unit test cases work run should support.Example: make unit test cases easier to review, adapt, and use in a real developers workflow
[constraints]
Rules for developer unit test cases work: tone, length, channel, privacy, and actual error output, code behavior, and passing verification.Example: verify against the actual codebase and test results before using
[review_lens]
Use this check before sharing: unit test cases quality, edge cases and assertions, and codebase verification.Example: unit test cases quality, edge cases and assertions, and codebase verification
[task_focus]
The detail that keeps this developer unit test cases work prompt specific: edge cases, assertions, fixtures, failure mode, and existing test style.Example: edge cases, assertions, fixtures, failure mode, and existing test style

Expected output

Expect a technical checklist with hypotheses, steps, risks, and verification commands that explicitly separates source-based content from assumptions and ends with a review pass for unit test cases quality, edge cases and assertions, and codebase verification.

Follow-up prompt

Now improve this working version into unit test cases by tightening unit test cases quality, edge cases and assertions, and codebase verification, emphasizing edge cases, assertions, fixtures, failure mode, and existing test style, removing unsupported claims, and giving me one stronger version for a code reviewer, teammate, maintainer, or future self.

Human review

Check whether the answer uses only provided context, handles actual error output, code behavior, and passing verification, fits a code reviewer, teammate, maintainer, or future self, reflects edge cases, assertions, fixtures, failure mode, and existing test style, and respects this boundary: verify against the actual codebase and test results before using.

Best for: Turning prepared context into unit test cases. Use when: Use before asking ChatGPT for unit test cases work so the model has enough task-specific context.

workflow

Write unit tests for developer Repeatable Workflow Prompt

Use this when unit test cases work repeats often enough to become unit tests prompt pattern with source notes, constraints, and review checklist.

Run this repeatable workflow prompt for Developers; stay practical, cite the pasted notes, and leave the final call with the human reviewer.
Task: help me with unit test cases work. Target result: unit test cases.
Source material I can provide: [source_material]. Typical source for this task is function behavior, edge cases, inputs, outputs, and existing test style.
Audience or stakeholder: [audience]. The output must work for a code reviewer, teammate, maintainer, or future self.
Task-specific focus to preserve: [task_focus]. If the pasted focus is broad, compare it with this page cue: edge cases, assertions, fixtures, failure mode, and existing test style.
Goal: [goal]. Constraints: [constraints]. Fact boundary for this run: keep actual error output, code behavior, and passing verification tied to [source_material], and mark any detail the notes do not support.
Run mode for unit test cases work: Run this as a repeatable workflow: separate one-time facts from fields that should change next time.
Stop rule: Stop if the reusable version would preserve private details or hide a human approval step.
Return a reusable step-by-step workflow with inputs, checks, and follow-up prompts.
Before writing unit test cases, ask up to 3 clarifying questions when [source_material] does not include function behavior, edge cases, inputs, outputs, and existing.
After the answer, include a human review section focused on [review_lens]. Verify actual error output, code behavior, and passing verification; and respect this boundary: verify against the actual codebase and test results before using.
Check cue: for unit test cases work, The user should get reusable fields, a run order, and a reject-if rule for the next use.
[source_material]
Paste the concrete developer unit test cases work notes, such as function behavior, edge cases, inputs, outputs, and existing test style.Example: function behavior, edge cases, inputs, outputs, and existing test style
[audience]
Who will read, use, approve, or act on this developer unit test cases.Example: a code reviewer, teammate, maintainer, or future self
[goal]
The choice or work outcome this developer unit test cases work run should support.Example: make unit test cases easier to review, adapt, and use in a real developers workflow
[constraints]
Rules for developer unit test cases work: tone, length, channel, privacy, and actual error output, code behavior, and passing verification.Example: verify against the actual codebase and test results before using
[review_lens]
Use this check before sharing: unit test cases quality, edge cases and assertions, and codebase verification.Example: unit test cases quality, edge cases and assertions, and codebase verification
[task_focus]
The detail that keeps this developer unit test cases work prompt specific: edge cases, assertions, fixtures, failure mode, and existing test style.Example: edge cases, assertions, fixtures, failure mode, and existing test style

Expected output

Expect a reusable step-by-step workflow with inputs, checks, and follow-up prompts that explicitly separates source-based content from assumptions and ends with a review pass for unit test cases quality, edge cases and assertions, and codebase verification.

Follow-up prompt

Now improve this working version into unit test cases by tightening unit test cases quality, edge cases and assertions, and codebase verification, emphasizing edge cases, assertions, fixtures, failure mode, and existing test style, removing unsupported claims, and giving me one stronger version for a code reviewer, teammate, maintainer, or future self.

Human review

Check whether the answer uses only provided context, handles actual error output, code behavior, and passing verification, fits a code reviewer, teammate, maintainer, or future self, reflects edge cases, assertions, fixtures, failure mode, and existing test style, and respects this boundary: verify against the actual codebase and test results before using.

Best for: Creating a reusable process for repeated unit test cases work. Use when: Use when unit test cases work repeats often enough to need a standard process.

review

Write unit tests for developer Human Review Prompt

Use this after there is already working copy and the main need is unit test cases quality, edge cases and assertions, and codebase verification.

Run this human review prompt for Developers; stay practical, cite the pasted notes, and leave the final call with the human reviewer.
Task: help me with unit test cases work. Target result: unit test cases.
Source material I can provide: [source_material]. Typical source for this task is function behavior, edge cases, inputs, outputs, and existing test style.
Audience or stakeholder: [audience]. The output must work for a code reviewer, teammate, maintainer, or future self.
Task-specific focus to preserve: [task_focus]. If the pasted focus is broad, compare it with this page cue: edge cases, assertions, fixtures, failure mode, and existing test style.
Goal: [goal]. Constraints: [constraints]. Fact boundary for this run: keep actual error output, code behavior, and passing verification tied to [source_material], and mark any detail the notes do not support.
Run mode for unit test cases work: Run this as a review of existing copy: score the answer, name the weak sections, and propose repairs.
Stop rule: Stop if the copy cannot be traced back to the supplied source material or the reviewer is not named.
Return a scored review table with issues, fixes, and what still needs human judgment.
Before writing unit test cases, ask up to 3 clarifying questions when [source_material] does not include function behavior, edge cases, inputs, outputs, and existing.
After the answer, include a human review section focused on [review_lens]. Verify actual error output, code behavior, and passing verification; and respect this boundary: verify against the actual codebase and test results before using.
Check cue: for unit test cases work, The user should get a choice about accept, repair, or reject before polishing the wording.
[source_material]
Paste the concrete developer unit test cases work notes, such as function behavior, edge cases, inputs, outputs, and existing test style.Example: function behavior, edge cases, inputs, outputs, and existing test style
[audience]
Who will read, use, approve, or act on this developer unit test cases.Example: a code reviewer, teammate, maintainer, or future self
[goal]
The choice or work outcome this developer unit test cases work run should support.Example: make unit test cases easier to review, adapt, and use in a real developers workflow
[constraints]
Rules for developer unit test cases work: tone, length, channel, privacy, and actual error output, code behavior, and passing verification.Example: verify against the actual codebase and test results before using
[review_lens]
Use this check before sharing: unit test cases quality, edge cases and assertions, and codebase verification.Example: unit test cases quality, edge cases and assertions, and codebase verification
[task_focus]
The detail that keeps this developer unit test cases work prompt specific: edge cases, assertions, fixtures, failure mode, and existing test style.Example: edge cases, assertions, fixtures, failure mode, and existing test style

Expected output

Expect a scored review table with issues, fixes, and what still needs human judgment that explicitly separates source-based content from assumptions and ends with a review pass for unit test cases quality, edge cases and assertions, and codebase verification.

Follow-up prompt

Now improve this working version into unit test cases by tightening unit test cases quality, edge cases and assertions, and codebase verification, emphasizing edge cases, assertions, fixtures, failure mode, and existing test style, removing unsupported claims, and giving me one stronger version for a code reviewer, teammate, maintainer, or future self.

Human review

Check whether the answer uses only provided context, handles actual error output, code behavior, and passing verification, fits a code reviewer, teammate, maintainer, or future self, reflects edge cases, assertions, fixtures, failure mode, and existing test style, and respects this boundary: verify against the actual codebase and test results before using.

Best for: Finding weak spots in existing working copy. Use when: Use after developers already have working copy and need to check unit test cases quality, edge cases and assertions, and codebase verification.

format

Write unit tests for developer Format Conversion Prompt

Use this when the substance is right but the output needs to fit a table, checklist, email, outline, or script.

Run this format conversion prompt for Developers; stay practical, cite the pasted notes, and leave the final call with the human reviewer.
Task: help me with unit test cases work. Target result: unit test cases.
Source material I can provide: [source_material]. Typical source for this task is function behavior, edge cases, inputs, outputs, and existing test style.
Audience or stakeholder: [audience]. The output must work for a code reviewer, teammate, maintainer, or future self.
Task-specific focus to preserve: [task_focus]. If the pasted focus is broad, compare it with this page cue: edge cases, assertions, fixtures, failure mode, and existing test style.
Goal: [goal]. Constraints: [constraints]. Fact boundary for this run: keep actual error output, code behavior, and passing verification tied to [source_material], and mark any detail the notes do not support.
Run mode for unit test cases work: Run this as format conversion: preserve the facts and change only the structure, order, or channel fit.
Stop rule: Stop if the requested format would require adding facts that were not in the original answer.
Return the same content reshaped without adding new facts.
Before writing unit test cases, ask up to 3 clarifying questions when [source_material] does not include function behavior, edge cases, inputs, outputs, and existing.
After the answer, include a human review section focused on [review_lens]. Verify actual error output, code behavior, and passing verification; and respect this boundary: verify against the actual codebase and test results before using.
Check cue: for unit test cases work, The user should get a reshaped version plus a note showing what stayed unchanged.
[source_material]
Paste the concrete developer unit test cases work notes, such as function behavior, edge cases, inputs, outputs, and existing test style.Example: function behavior, edge cases, inputs, outputs, and existing test style
[audience]
Who will read, use, approve, or act on this developer unit test cases.Example: a code reviewer, teammate, maintainer, or future self
[goal]
The choice or work outcome this developer unit test cases work run should support.Example: make unit test cases easier to review, adapt, and use in a real developers workflow
[constraints]
Rules for developer unit test cases work: tone, length, channel, privacy, and actual error output, code behavior, and passing verification.Example: verify against the actual codebase and test results before using
[review_lens]
Use this check before sharing: unit test cases quality, edge cases and assertions, and codebase verification.Example: unit test cases quality, edge cases and assertions, and codebase verification
[task_focus]
The detail that keeps this developer unit test cases work prompt specific: edge cases, assertions, fixtures, failure mode, and existing test style.Example: edge cases, assertions, fixtures, failure mode, and existing test style

Expected output

Expect the same content reshaped without adding new facts that explicitly separates source-based content from assumptions and ends with a review pass for unit test cases quality, edge cases and assertions, and codebase verification.

Follow-up prompt

Now improve this working version into unit test cases by tightening unit test cases quality, edge cases and assertions, and codebase verification, emphasizing edge cases, assertions, fixtures, failure mode, and existing test style, removing unsupported claims, and giving me one stronger version for a code reviewer, teammate, maintainer, or future self.

Human review

Check whether the answer uses only provided context, handles actual error output, code behavior, and passing verification, fits a code reviewer, teammate, maintainer, or future self, reflects edge cases, assertions, fixtures, failure mode, and existing test style, and respects this boundary: verify against the actual codebase and test results before using.

Best for: Changing the output format without changing the facts. Use when: Use when the answer needs a precise structure before developers can review it.

privacy

Write unit tests for developer Privacy-Safe Prompt

Use this when the source material contains private, sensitive, or account-specific details.

Run this privacy-safe prompt for Developers; stay practical, cite the pasted notes, and leave the final call with the human reviewer.
Task: help me with unit test cases work. Target result: unit test cases.
Source material I can provide: [source_material]. Typical source for this task is function behavior, edge cases, inputs, outputs, and existing test style.
Audience or stakeholder: [audience]. The output must work for a code reviewer, teammate, maintainer, or future self.
Task-specific focus to preserve: [task_focus]. If the pasted focus is broad, compare it with this page cue: edge cases, assertions, fixtures, failure mode, and existing test style.
Goal: [goal]. Constraints: [constraints]. Fact boundary for this run: keep actual error output, code behavior, and passing verification tied to [source_material], and mark any detail the notes do not support.
Run mode for unit test cases work: Run this as a sanitizing pass: replace private details with role-safe descriptions before writing.
Stop rule: Stop if names, identifiers, account details, confidential strategy, or one-time records are still present.
Return a sanitized prompt-ready summary plus a list of removed details.
Before writing unit test cases, ask up to 3 clarifying questions when [source_material] does not include function behavior, edge cases, inputs, outputs, and existing.
After the answer, include a human review section focused on [review_lens]. Verify actual error output, code behavior, and passing verification; and respect this boundary: verify against the actual codebase and test results before using.
Check cue: for unit test cases work, The user should get a safe summary, removed-detail list, and a reusable version without sensitive data.
[source_material]
Paste the concrete developer unit test cases work notes, such as function behavior, edge cases, inputs, outputs, and existing test style.Example: function behavior, edge cases, inputs, outputs, and existing test style
[audience]
Who will read, use, approve, or act on this developer unit test cases.Example: a code reviewer, teammate, maintainer, or future self
[goal]
The choice or work outcome this developer unit test cases work run should support.Example: make unit test cases easier to review, adapt, and use in a real developers workflow
[constraints]
Rules for developer unit test cases work: tone, length, channel, privacy, and actual error output, code behavior, and passing verification.Example: verify against the actual codebase and test results before using
[review_lens]
Use this check before sharing: unit test cases quality, edge cases and assertions, and codebase verification.Example: unit test cases quality, edge cases and assertions, and codebase verification
[task_focus]
The detail that keeps this developer unit test cases work prompt specific: edge cases, assertions, fixtures, failure mode, and existing test style.Example: edge cases, assertions, fixtures, failure mode, and existing test style

Expected output

Expect a sanitized prompt-ready summary plus a list of removed details that explicitly separates source-based content from assumptions and ends with a review pass for unit test cases quality, edge cases and assertions, and codebase verification.

Follow-up prompt

Now improve this working version into unit test cases by tightening unit test cases quality, edge cases and assertions, and codebase verification, emphasizing edge cases, assertions, fixtures, failure mode, and existing test style, removing unsupported claims, and giving me one stronger version for a code reviewer, teammate, maintainer, or future self.

Human review

Check whether the answer uses only provided context, handles actual error output, code behavior, and passing verification, fits a code reviewer, teammate, maintainer, or future self, reflects edge cases, assertions, fixtures, failure mode, and existing test style, and respects this boundary: verify against the actual codebase and test results before using.

Best for: Sanitizing context before asking ChatGPT for help. Use when: Use before adding sensitive context so private details stay out.

short

Write unit tests for developer Fast Checklist Prompt

Use this for a quick pass when the user only needs the next few choices for unit test cases work.

Run this fast checklist prompt for Developers; stay practical, cite the pasted notes, and leave the final call with the human reviewer.
Task: help me with unit test cases work. Target result: unit test cases.
Source material I can provide: [source_material]. Typical source for this task is function behavior, edge cases, inputs, outputs, and existing test style.
Audience or stakeholder: [audience]. The output must work for a code reviewer, teammate, maintainer, or future self.
Task-specific focus to preserve: [task_focus]. If the pasted focus is broad, compare it with this page cue: edge cases, assertions, fixtures, failure mode, and existing test style.
Goal: [goal]. Constraints: [constraints]. Fact boundary for this run: keep actual error output, code behavior, and passing verification tied to [source_material], and mark any detail the notes do not support.
Run mode for unit test cases work: Run this as a fast choice pass: give only the next actions, the missing input, and the main risk.
Stop rule: Stop if the user needs a full artifact, a legal answer, a policy choice, or unsupported factual claims.
Return a concise checklist with the next action and the main risk.
Before writing unit test cases, ask up to 3 clarifying questions when [source_material] does not include function behavior, edge cases, inputs, outputs, and existing.
After the answer, include a human review section focused on [review_lens]. Verify actual error output, code behavior, and passing verification; and respect this boundary: verify against the actual codebase and test results before using.
Check cue: for unit test cases work, The user should get a narrow next step they can complete before opening a longer prompt.
[source_material]
Paste the concrete developer unit test cases work notes, such as function behavior, edge cases, inputs, outputs, and existing test style.Example: function behavior, edge cases, inputs, outputs, and existing test style
[audience]
Who will read, use, approve, or act on this developer unit test cases.Example: a code reviewer, teammate, maintainer, or future self
[goal]
The choice or work outcome this developer unit test cases work run should support.Example: make unit test cases easier to review, adapt, and use in a real developers workflow
[constraints]
Rules for developer unit test cases work: tone, length, channel, privacy, and actual error output, code behavior, and passing verification.Example: verify against the actual codebase and test results before using
[review_lens]
Use this check before sharing: unit test cases quality, edge cases and assertions, and codebase verification.Example: unit test cases quality, edge cases and assertions, and codebase verification
[task_focus]
The detail that keeps this developer unit test cases work prompt specific: edge cases, assertions, fixtures, failure mode, and existing test style.Example: edge cases, assertions, fixtures, failure mode, and existing test style

Expected output

Expect a concise checklist with the next action and the main risk that explicitly separates source-based content from assumptions and ends with a review pass for unit test cases quality, edge cases and assertions, and codebase verification.

Follow-up prompt

Now improve this working version into unit test cases by tightening unit test cases quality, edge cases and assertions, and codebase verification, emphasizing edge cases, assertions, fixtures, failure mode, and existing test style, removing unsupported claims, and giving me one stronger version for a code reviewer, teammate, maintainer, or future self.

Human review

Check whether the answer uses only provided context, handles actual error output, code behavior, and passing verification, fits a code reviewer, teammate, maintainer, or future self, reflects edge cases, assertions, fixtures, failure mode, and existing test style, and respects this boundary: verify against the actual codebase and test results before using.

Best for: Getting a quick choice checklist before spending more time. Use when: Use when time is short and the user needs the next action, not a full answer.