Stage 5 · Lesson 4 of 6
Recognising tests that cannot fail
AI-generated tests often look thorough and check nothing. Common forms: asserting that a (a fake stand-in for a real ) was called with the values the test itself passed in; snapshot tests that save output nobody reviews; tests with no at all; tests that only check a function returns something; and tests so heavily mocked that the real code never runs.
The quickest check is to break the code on purpose: change a > to >=, return early, or delete a line, then rerun. If nothing fails, the tests are decoration. tools such as Stryker, mutmut and PIT automate this by making many small changes and reporting which ones no test catches.
Common traptrusting a high number, which counts lines run, not whether any result was checked.
A question to check yourself, an AI practice session and 2 cheat sheet entries come when you add the roadmap to your account. Add it
Resources for this stage
Start with· follow one of these
- BookFreeTest-Driven Development with Python (Obey the Testing Goat)
Harry Percival · Intermediate
Free online: test-driven development taught step by step on a real web app
- BookPaidTest Driven Development: By Example
Kent Beck (Addison-Wesley) · Intermediate · Paid
Kent Beck's short classic on the red, green, refactor loop, worked through by example