your code works. ¡ Does your code do what’s expected, and nothing else? Provide usage examples for the next guy. ¡ Can other developers see examples of how your code is used? Use your API before you make it. ¡ Map out how you would use code before writing it. Minimize mistakes, maximize productivity ¡ Writing tests saves time, money, and lives.
unit of your source code. ¡ Typically repeatable, consistent, and fast. ¡ Try to mock complex dependencies and interactions to the outside world. Regression Tests ¡ Goal: Verify that a bug never happens again. ¡ Fixes known software bugs. ¡ Uncovers new software bugs. Acceptance Tests ¡ Goal: Verify a feature is correctly implemented. Smoke Tests ¡ Goal: Ensure software and system doesn’t blow up. Load Tests ¡ Goal: Measure response times and performance of software and system.
lib. ¡ Most used package for testing web applications. coverage.py ¡ Tool used to measure coverage of Python programs, not just Django. django.test ¡ Django.test is pretty much the unittest package library. nose ¡ Extends unittest lib and can make automated testing easier. django-discover-runner ¡ A python acceptance test tool for web applications. Jenkins CI ¡ Use to test and deploy code. Selenium ¡ Automate web application acceptance test.
¡ Creating, updating, or removing database records Shady Code ¡ Shady code is untested code that appears confusing or looks wrong. Specific to Django ¡ Custom views and forms ¡ Overriding methods core to Django ¡ Code that relies on untested third-party packages (optional).
2. Coverage isn’t everything. 3. Be willing to invest in test fixtures. 4. If you aren’t convinced on the value of testing, your team won’t be either. 5. Harvest metrics. 6. Capture bugs in an automated test. 7. Pause to refactor when test suite takes too long to run 8. Be ready to throw away an entire day of changes.