Just because AI can write your tests - should it?
summary
Demo uses a FastAPI app and asks LLMs to generate tests: GB5 writes 10 tests (8 pass, 75% route coverage) and Sonnet 4.5 writes 61 tests (96% coverage) but takes more tokens and time. Generated tests exhibit flaky cleanup, duplicated cases, boring fake data, and shallow assertions. Remedies shown: use pytest parameterize and fixtures, faker for realistic inputs, snapshot testing for JSON, and Hypothesis/Schemathesis to find huge-int and schema edge-case errors. Use LLMs to bootstrap but seed them and add specialist tools.
AI-written summary · about
chapters (15)
- 0:00Introduction and poll
- 1:12Why bees matter
- 5:44LLMs as generalists
- 7:09AI writing tests demo
- 9:12Coverage debate and improvements
- 11:38Fixing redundant and fake test data
- 13:20Better fake data with Faker
- 14:46Testing JSON endpoints with snapshots
- 16:31Beyond coverage with property tests
- 18:58Property-based testing with Hypothesis
- 21:27Schema testing with Schemathesis
- 22:32Should you use AI for tests?
- 24:17Specialists vs generalists in testing
- 25:17Q&A on TDD and LLM tests
- 27:48Future of test writing
