Module 10 of 12

Testing & Debugging

Lessons

About This Module

Code that works today can quietly break tomorrow. Automated tests let you change a Django project with confidence, because a failing test tells you exactly what you broke, and debugging tools help you find out why when something does not behave as expected.

In this module you will learn how to write unit tests for models and views using Django's TestCase and the test client, how to run them, and how pytest-django offers a more concise alternative. You will then learn how to track down problems with the Django Debug Toolbar, which shows the SQL queries, timings, and context behind each request.

Watch the lessons in order, then continue on to Security & Performance. Some of these videos were recorded on older Django releases, so check the official documentation if a detail differs on your install.

Lessons

4 videos
01

Mastering Django Unit Testing: An In-Depth Introduction and Tutorial

Covers the basic principles of testing and shows how to write effective tests for Django models and views.

02

Testing in Django Tutorial #7 - TestCase

Part of a Django unit testing series on unit and integration testing, this episode focuses on writing tests with the TestCase class.

03

Django Testing #1: How to Create Tests Using pytest-django

Shows how to create tests for a Django application with the pytest-django package.

04

Mastering Django Debug Toolbar: Efficient Debugging and Optimization Techniques

Walks through installing and configuring the Django Debug Toolbar and using it to debug your Django code.