Evaluate Coding Agent Test Suites for False Positive Traps

Audits agent-generated unit tests to catch tautological assertions, over-mocking, and tests that still pass when core business logic is disabled.

Agent prompt for Claude Code and Cursor

You get: Flawed Test Name, flaw Classification and why It Passes Incorrectly

Prompt

Prompt
Act as a principal software QA engineer specializing in mutation testing and automated verification. Analyze the test suite and source implementation pasted below to identify false-positive assertion traps commonly produced by AI coding agents.

Rules:
1. Scrutinize all mock setups. Flag any test where the mock returns data that bypasses the actual business logic or asserts only on mock calls instead of final state.
2. Identify tautological assertions (such as asserting true is true, checking type instead of value, or mirroring internal calculations without validation).
3. Apply a virtual mutation test: explain specifically what breaks or stays green if the core logic block is commented out or hardcoded to return a static value.
4. Do not invent edge cases outside the provided logic. Focus strictly on whether the existing assertions genuinely prove the code works.

Output format:
- Flawed Test Name
- Flaw Classification: Over-mocking, Tautological Assertion, or Silent Pass
- Why It Passes Incorrectly: 2-3 sentences explaining the false confidence
- Mutation Failure Test: What happens if business logic is removed or altered
- Corrected Test Code: Minimal rewrite asserting on actual side effects or returned values

Paste your implementation code and corresponding test file directly below this prompt.

Example output

How the flawed test is audited and fixedFlaw found in test_calculate_tier_discount_applied
  1. Identify flawed testtest_calculate_tier_discount_applied
  2. Classify the flawOver-mocking of TierRulesEngine.get_discount_rate
  3. Explain false passOnly checks the mock was called once, not the total
  4. Run mutation testcalculate_total returns cart.subtotal and the test stays green
  5. Write corrected testReal rules; asserts discount 1500 and total 8500 cents

Example for: an e-commerce checkout discount calculator tested by an AI coding agent.

Flawed Test Name

test_calculate_tier_discount_applied

Flaw Classification

Over-mocking

Why It Passes Incorrectly

The test mocks the internal TierRulesEngine.get_discount_rate method to directly return 0.15 and verifies only that engine.get_discount_rate() was called once. It never checks if the calculated total accurately subtracts $15 from a $100 cart, meaning the actual mathematical deduction in calculate_total is never executed or verified against state.

Mutation Failure Test

If calculate_total() is changed to simply return cart.subtotal without applying any discount, the test suite still reports 100% green because the assertion only verifies mock_engine.called_once().

Corrected Test Code
def test_calculate_tier_discount_applied():
    # Use real rule configuration instead of mocking internal methods
    cart = Cart(items=[CartItem(name="Headphones", price_cents=10000)])
    customer = Customer(tier="GOLD", lifetime_spend_cents=50000)
    
    result = calculate_final_checkout(cart, customer)
    
    # Assert against real output values, not mock invocations
    assert result.discount_cents == 1500
    assert result.total_cents == 8500
    assert result.status == "READY_FOR_PAYMENT"

Assumption note: This evaluation assumes external network services like payment gateways remain mocked at the outer boundary rather than within internal business logic modules.

Written by AI from this prompt. Your results will vary.

Tips and common edits

Why this works

  • Forces a virtual mutation check that exposes tests that pass even when underlying logic is deleted.
  • Specifically targets over-mocking traps where tests only verify mock calls rather than business outcomes.
  • Provides immediately usable replacement tests that verify concrete state rather than internal method wiring.

Paste your application logic and its agent-generated test file immediately after the prompt. Works directly in Claude Code, Cursor, Codex, or GitHub Copilot chat.

Common edits

  • Add a constraint targeting a specific language or framework (such as Jest, Pytest, or Go testing).
  • Request test runs against specific failure boundaries like zero values, empty lists, or API timeouts.

Reuse it: Use in a workflowAdapt in the builder

Prompt details

By
Prompts-GPT editors
Published
How prompts are written and checked

Did this prompt work?

AI Coding AgentsClaude Code

Review AI Pull Requests for Phantom Imports and Bloat

Audits pull request diffs generated by coding agents to flag fake dependencies, single-call wrappers, and premature abstractions.

AI Coding AgentsClaude Code

Verify the Coding Agent's 'Done' Claim Against the Diff and Test Output

Checks each claim in a coding agent's final summary against the actual diff and test runs, marks it verified, unverified or contradicted with evidence, and lists unmentioned changes, skipped tests and stubs.

AI Coding AgentsClaude Code

Audit AI Code Diffs for Performance Regressions

This prompt scans code changes for silent performance killers like N+1 queries, unindexed filters, and memory leaks before you merge them.

AI Coding AgentsClaude Code

Audit PR Git Diffs for Scope Creep and Churn

Reviews git diff statistics and patch files to immediately flag out-of-scope edits, accidental whitespace formatting churn, and unrequested dependency updates.

AI Coding AgentsClaude Code

Pre-Merge Self-Review of a Git Diff: Correctness, Security, and Test Gaps

Has Claude Code review a branch diff like a skeptical maintainer, producing severity-ranked findings with evidence and a clear merge, fix, or block recommendation. Use it before opening or approving a pull request.

AI Coding AgentsClaude Code

Convert User Stories into Strict Acceptance Test Assertions

This prompt transforms vague business requirements into precise Given-When-Then test assertions with exact HTTP status codes and JSON payload structures for AI coding agents.