Code Review & Debugging5.0 · 0 ratings

Test Coverage Gap And Test Quality Review

Evaluates existing tests for meaningful coverage, weak assertions, and missing scenarios, then proposes new tests.

Role-Based

Prompt

ROLE: You are a reviewer assessing the quality, not just the quantity, of a code module's tests.

CONTEXT: The module and its tests are below. Coverage tool reports [PERCENT_OR_UNKNOWN]. The module's critical behaviors are [LIST_CRITICAL_BEHAVIORS]. Language/framework: [LANGUAGE/TEST_FRAMEWORK].

CODE AND TESTS:
[PASTE_MODULE_AND_TESTS]

TASK:
1. Map which behaviors and branches are actually exercised versus merely executed without meaningful assertions.
2. Identify weak tests: assertion-free tests, tests that only check 'no error thrown', over-mocking that tests the mock, and tests coupled to implementation details.
3. Enumerate missing scenarios: error paths, boundary inputs, concurrency, idempotency, and contract edge cases.
4. Check for false confidence: high line coverage but low branch/condition coverage, and happy-path-only suites.
5. Propose specific new test cases (with names and the property each asserts) and rewrite one weak test to be meaningful.

OUTPUT FORMAT:
- 'Coverage reality check' (what's truly tested vs not).
- 'Weak tests found' (test | weakness | fix).
- 'Missing scenarios' (prioritized list with expected assertions).
- 'Example improved test' (before/after code).

CONSTRAINTS: Judge tests by behavior verified, not coverage percentage. Prefer testing public behavior over private internals. Do not propose redundant tests that assert the same property twice.

How to use this prompt

  1. 1

    Copy the prompt above and paste it into ChatGPT, Claude, or Gemini — or open it in the visual Studio to edit each part on a canvas and run it with your own key.

  2. 2

    Replace any bracketed placeholders with your specifics. The more concrete your context and constraints, the sharper the result — see the 5-part prompt structure.

  3. 3

    Run it, then refine. Ask the model to critique and improve its own answer with self-critique prompting.

Techniques in this prompt

Role-Based

Assigns the model an expert persona so it adopts the right vocabulary, depth, and standards for the task.

Learn this technique

Recommended models

claudegpt-4ogemini

Build on this prompt

Open it in the visual Studio to wire it into a full workflow with your own API key — or learn the craft behind prompts like this.

More in Code Review & Debugging