A test that a coding agent writes from the same prompt as its implementation shares the agent's assumptions. If the agent believed the database always returns a row, the test it writes will also believe that, and both will be wrong together. The Thoughtbot review guide names this directly: AI will do whatever it needs to get a test passing, including stubbing or mocking the very implementation it is supposed to be checking.
The fix is to write the case yourself, in plain terms, before the agent touches the suite. Each case needs three concrete things:
- A starting state anyone can reconstruct (a fixed clock, an empty table, a queue with one message).
- One specific input, with literal values, not "some valid payload."
- An expected output plus the state changes that must be visible afterward.
Here is the difference in practice. The weak version came from the agent's own prompt and would pass on an empty cart:
def test_cart_survives_address_change():
cart = build_cart()
cart.change_address("1 New St")
assert cart.items is not None # passes on a broken cart
The version you write states the input and the expected output with numbers:
def test_cart_keeps_two_items_after_address_change():
cart = build_cart(items=[("chair", 1), ("desk", 1)])
cart.change_address("1 New St")
assert [i.sku for i in cart.items] == ["chair", "desk"]
assert cart.total_cents == 42000
The SpecStory checklist asks a question that separates the two: for each added test, which change to the code would make it fail? If you cannot answer, the test is decoration. A batch of near-identical tests is a sign of test bloat that adds review time without catching more bugs, and the Google reviewer guide makes the same point in broader terms: a human has to confirm the tests are valid, because tests do not test themselves.
One decision rule keeps this cheap. Aim every test at one behavior that a product owner could describe in a sentence. If a case needs two sentences joined by "and", split it. Two small tests that fail independently tell you more than one large test that fails ambiguously.



