-
Book Overview & Buying
-
Table Of Contents
Web Development with Django - Second Edition
By :
In this chapter, we learned how to write test cases for different components of our web application project with Django. We learned why testing plays a crucial role in the development of any web application and the different types of testing techniques that are employed in the industry to make sure the application code they ship is stable and bug-free.
Then, we looked at how we can use the TestCase class provided by Django’s test module to implement our unit tests, which can be used to test the models as well as views. We also looked at how we can use Django’s test client to test our view functions, some of which require the user to be authenticated. We also glanced over another approach of using RequestFactory to test method views and class-based views.
We concluded this chapter by understanding the predefined classes provided by Django and where they should be used, while also looking at how we can modularize our testing code base to make it appear clean...