33 / 87 · 02 AI-Augmented Test Design · The 10x Review Pattern← prev⊞ allnext →☰ Read as one page
6.3The Mental Mutation Test
For every assertion, ask yourself: "If I removed or inverted this assertion, would a real bug go undetected?"
This is the fastest way to evaluate whether a test has actual value.
# Test with LOW mutation score
def test_get_user():
response = client.get("/api/users/1")
assert response.status_code == 200
# If the user's name field is empty, this test still passes.
# If the user's email is wrong, this test still passes.
# This test only verifies the endpoint exists and returns 200.
# Same test with HIGH mutation score
def test_get_user():
response = client.get("/api/users/1")
assert response.status_code == 200
user = response.json()
assert user["name"] == "Alice" # Catches name corruption
assert user["email"] == "alice@x.com" # Catches email corruption
assert user["role"] == "admin" # Catches role assignment bug
assert user["created_at"] is not None # Catches missing timestamp
Every additional assertion is a mutation that the test would catch. Aim for tests where removing any single assertion would leave a realistic bug undetected.