CC-301h · Module 1

Test Quality Review

3 min read

Generated tests need review just like generated code. The most common quality issues in Claude-generated tests: testing implementation details instead of behavior (asserting that a specific internal method was called rather than validating the output), weak assertions (toBeDefined instead of toBe(expectedValue)), missing cleanup (tests that leave state that affects subsequent tests), and tautological tests (tests that assert what the code does rather than what it should do).

The review prompt: "Review these tests for quality. Check for: (1) Are assertions testing behavior or implementation details? (2) Are assertions specific enough — toBe over toBeDefined? (3) Do tests clean up after themselves? (4) Could any test pass even if the function is broken?" This last check is the most important — a test that passes regardless of the function's behavior is worse than no test because it provides false confidence.