Audit intermediate Works with: Any AI

Unit Test Suite Quality Audit

Table output Has example

Audit a unit test suite to check whether the tests would catch real bugs, not just raise the coverage number, with gaps to fix.

The Open buttons send the prompt text as currently shown below to that site only when you click. Fill in the placeholders first.

Rate this prompt

Loading ratings…

Audit the unit tests of a module. Paste the module and its tests: [CODE_AND_TESTS]. Recent bugs that escaped: [ESCAPED_BUGS]. Coverage report if available: [COVERAGE].

Check whether tests assert behaviour or only that code runs, whether edge cases are covered, whether tests depend on each other or on time, whether mocks hide real problems, and whether the escaped bugs would have been caught. Identify tests that are flaky or too coupled to implementation.

Return a table with Test or area, Weakness, Missed bug it would not catch and Fix, ten tests to add with names and what each asserts, and a plan to remove or rewrite weak tests.

Also propose a small experiment: introduce three deliberate bugs in a copy of the code and see how many tests fail, which is a rough way to judge whether the suite protects behaviour. Add a rule for naming tests so that failures explain themselves.

Then design a mutation-style experiment and a testing strategy for the module. Describe five small deliberate changes to the code, such as flipping a condition or removing a validation, and for each say which existing test should fail and whether it does. Use the results to estimate how well the suite protects behaviour. Create a plan for adding tests in priority order: bugs that escaped, boundaries, error paths and invariants. Provide guidance on test structure, naming, arrangement of data, avoiding over-mocking and keeping tests quick. Suggest a minimal property-based test for one function with a clear invariant. Add a policy for what to do when a bug is found: write a failing test first. Propose coverage as a hint and not as a goal, and define two quality measures that reflect the suite's real value. Run any suggested code yourself before relying on it.

Fill in before use

Optional: type your details and the prompt above updates. Nothing is saved or sent.

Replace each bracketed placeholder with your own details, then paste into Any AI or another assistant.

See an example result (fictional data)
Experiment (invented module: discount calculator)
Deliberate changes: flip >= to > in the threshold; remove a null check; change rounding to floor; skip tax; swap two arguments.
Result: tests fail for 2 of 5 changes (threshold, arguments). The null check, rounding and tax changes pass unnoticed.
Weaknesses: tests assert that a function returns a number, not the value; two tests depend on today's date.
Ten tests to add (names): applies_ten_percent_at_threshold, rounds_half_up, rejects_negative_quantity, includes_tax_after_discount, handles_empty_cart...
Policy: a bug fix starts with a failing test. Coverage is a hint, not a goal.

Illustrative only, made-up data. Your results will differ and must be reviewed.

Related prompts