Testing for the Terrified: How to Write Tests, Conquer Guilt, and Level Up
summary
Uses Python and pytest to write tests live for a small wrapper script, exercising the build_command function, turning failing assertions into passing ones, covering the urgent and non-urgent branches, and using pytest.raises to mark expected errors. Advocates a harm-reduction approach: start with pure functions and write pinning tests to document current behavior, aim for incremental coverage (even ~10% helps), and focus on practical, small steps that make code easier to refactor.
AI-written summary · about
chapters (20)
- 0:00Introduction
- 0:19What this talk is not
- 1:33What this talk is about
- 2:37Why testing is cool
- 5:10Why dont we do it
- 5:50Writing a script
- 6:47Pressure
- 8:11Pager
- 8:29Onetime use scripts
- 8:55Harm reduction
- 10:14Unit tests
- 11:13Writing tests
- 13:08Where to start
- 14:57Writing the tests
- 15:19Writing a help script
- 18:02Setting up the build command
- 19:44Python test framework
- 20:14Importing a function
- 21:52Writing a failing test
- 27:33Expected errors
related talks
28mEgad! How Do We Start Writing Better Tests?
17mTest! (Some OF) Your! Code!: How To Write...
21mDon't just test, my friend, test better
28m"WHAT IS THIS MESS?" - Writing tests for pre-existing code bases
29mEgad! How Do We Start Writing (Better) Tests?
23mThe Unspeakable Horror of Discovering You Didn't Write Tests
27mWhy I use py.test and maybe you should too
30mStop Writing Tests!
