Build with AI: From Zero to Your First App · Module 7: Debugging and testing
Test Normal, Edge and Invalid Plus Old Features
Fixes that are not tested are rumors. This lesson runs a short routine that proves the fix and proves nothing else broke.
10 min reading
Objectives
- Test every fix with normal, edge and invalid inputs
- Re-run old features after each change (no regressions)
- Write the test list before the fix, run it after
- Explain why 'it opens' is not a functional test
Why this matters
The classic beginner arc: fix the validation message, break the echo; fix the echo, break persistence; fix persistence, break the layout. Each repair untested, each test skipped "because the change was small". Small changes break things precisely because they touch shared code. A five-minute routine after every fix ends the arc.
Concepts
Three input classes. Normal (2 loaves, Friday 10:00): the everyday case must pass. Edge (1 loaf minimum, 50 maximum, longest dish name, narrowest width): boundaries must hold. Invalid (empty, spaces, letters in quantity, past time): guards must answer with sentences, values kept. Lesson M05L17 to M05L19 built the guards; this lesson proves them per fix.
Old features re-run. Every fix ends with the regression pass: echo still echoes, validation still messages, list still persists, layout still fits at 360px. Four old checks, two minutes. A fix that repairs one thing by breaking another is not a fix; it is a move. The routine catches moves.
Test list before fix. Write the checks the fix must pass before changing anything (the acceptance criteria habit from M02L8, now per bug). Run the list after. "It opens" never appears: opening proves rendering, hands prove behavior (fill, submit, reload, delete, break on purpose).
Worked example
Fix: storage quota check plus message. Test list: normal submit persists; edge: exactly-50 loaves accepted; invalid: empty still guarded with sentence; old: echo intact, validation messages intact, 360px layout intact, delete works. Run: all pass in four minutes. Without the list, the layout check would have been skipped, and the message styling did overflow at 360px: caught only because the routine is unconditional.
Expected result: a written test list run after your next fix with normal, edge, invalid and old-feature lines all checked off.
The common wrong move
Testing only the reported case ("the reported bug is fixed, ship it"). The reported case is the minority of behavior. Routines test the neighborhood, not just the address.
Lab and next step
Lab A21 runs the full routine on a provided fix with a planted regression. Next, lesson 28 breaks the most expensive loop: asking AI for the same fix repeatedly.
Quick check
An optional 4-question self-check. Answers never leave your device, are not stored, and never count toward any assessment.
Lesson feedback
No published feedback yet.
Log in and complete the lesson to leave feedback.
Exercise
Before your next fix, write the test list (normal, edge, invalid, old features). After the fix, run it fully and record every line pass or fail.
Pass criteria
Test list written before the fix; normal/edge/invalid plus at least three old-feature lines; every line recorded pass or fail after the fix.