Sample project (own tool, no client). Target: the data-analysis pipeline on the previous page. Environment: Python 3.12, pandas 3.0.5, Linux.
| ID | Case | Type | Expected | Status |
|---|---|---|---|---|
| TC-01 | Happy path (244-row CSV) | Functional | Exit 0; report prints; 244 rows stored | PASS |
| TC-02 | Missing file | Negative | Clean error, non-zero exit | PASS |
| TC-03 | Schema violation (missing columns) | Negative | Clear ValueError naming columns | PASS |
| TC-04 | Non-numeric coercion ("abc" in total_bill) | Data quality | Row dropped, count reported | PASS |
| TC-05 | Negative tip value | Data quality | Validation assertion fires | PASS |
| TC-06 | Empty dataset (header-only CSV) | Negative | Graceful handling, no crash | PASS |
| TC-07 | Output correctness | Functional | Matches independent computation | PASS |
Found by: TC-03/TC-05. Before: clean one-line error for missing files but raw 12-line tracebacks for schema/business-rule violations. Fix: wrap validate+summarize in structured error handling → one-line ERROR: input validation failed: <reason>, exit 1. Verified: both retests clean, exit 1; happy path still exit 0.
Found by: TC-06. Before: header-only CSV passed validation then crashed with ValueError: attempt to get argmax of an empty sequence from deep inside aggregation. Fix: early guard — ERROR: dataset contains 0 data rows, exit 1. Verified: clean error, exit 1; regression on full dataset unchanged.