- Tells you when your code is broken
- Manual testing sucks
- Prevent against regressions
- Upgrading dependencies
- Refactoring
- Documentation
- Other devs can read your tests to see how you intended your code to be used
- Helps with design
- Code that is hard to test is a code smell
- Code that is easy to test knows as little as possible about the outside world
- doctest
- fragile/ugly
- should only be used to ensure test code in documentation is correct
- unittest
- xUnit style
- lots of boilerplate/ugly self.assertEqual(x, y) ??
- py.test/nose
- native assertions/pretty! assert x == y
- powerful
- fixtures
- useful failure messages
- pdb integration
- parametrize/marking tests
- Unit tests
- Integration tests
- System/Functional/Acceptance tests
- Bug fixing/regression
- Test after
- Test first
- Spike
- mock/patching
- coverage.py
- demo actual test suite