Unit test organization strategies for Django projects
What is “Unit Testing”? A method by which individual units of source code are tested.
- Each app needs it’s own test module.
- Each module should have (many) submodules.
- Each contains classes that test units of code.
- Organize your test suite however you want
- Just be consistent.
Testing 3rd party APIs or cache
Smaller, modular code is testable, 200-line functions aren’t.
Tests are alive
Testing a virgin codebase
Successful strategies
Require unit tests for all code going forward
Reserve time to clear out test debt
- Good for new team members
- Everyone takes a turn
Establish a good foundation to build on
Every bug is two bugs:
- One in the code that broke
- One is the test that would/will catch the bug
Test data
Should I get test data from cache?
Graceful code degredation
Forcing awareness
Test infrastructe
Testing tools
Code not tested is broken by design