Step-by-step process to writing tests

Writing tests before changing the code is similar to erecting a scaffolding before the restoration of an old building. It provides a structural framework that helps you confidently undertake repairs.

You might want to approach this process in a stepwise manner as follows:

  1. Identify the area you need to make changes to. Your bug reports can be a good guide for narrowing down the problem area. Write characterization tests focusing on this area until you have satisfactorily captured its behavior.
  2. Look at the changes you need to make and write specific test cases for those. Resist the temptation to add new functionality. Prefer smaller unit tests to larger and slower integration tests.
  3. Introduce incremental ...

Get Django Design Patterns and Best Practices - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.