Chapter 4. Getting Fancier: Django Unit Test Extensions
In the last chapter, we started learning how to use unit tests to test Django applications. This included learning about some Django-specific support, such as how to get test data loaded from fixture files into the database for a particular test. So far, though, our testing focus has been on small building blocks that make up the application. We have not yet begun to write code to serve up web pages for our application, nor considered how we will test whether the pages are served properly and contain the correct content. The Django TestCase
class provides support that is useful for this broader kind of testing, which will be the focus of this chapter. In this chapter, we will:
First learn how to use a tests directory for our Django application tests instead of a single
tests.py
file. This will allow us to organize the tests logically instead of having all sorts of different tests mixed up in a single huge file.Develop some web pages...