Debian Codegraph @

docs/topics/testing/index.txt

raw
1 =================
2 Testing in Django
3 =================
4
5 Automated testing is an extremely useful bug-killing tool for the modern
6 web developer. You can use a collection of tests -- a **test suite** -- to
7 solve, or avoid, a number of problems:
8
9 * When you're writing new code, you can use tests to validate your code
10 works as expected.
11
12 * When you're refactoring or modifying old code, you can use tests to
13 ensure your changes haven't affected your application's behavior
14 unexpectedly.
15
16 Testing a web application is a complex task, because a web application is made
17 of several layers of logic -- from HTTP-level request handling, to form
18 validation and processing, to template rendering. With Django's test-execution
19 framework and assorted utilities, you can simulate requests, insert test data,
20 inspect your application's output and generally verify your code is doing what
21 it should be doing.
22
23 The preferred way to write tests in Django is using the :mod:`unittest` module
24 built-in to the Python standard library. This is covered in detail in the
25 :doc:`overview` document.
26
27 You can also use any *other* Python test framework; Django provides an API and
28 tools for that kind of integration. They are described in the
29 :ref:`other-testing-frameworks` section of :doc:`advanced`.
30
31 .. toctree::
32 :maxdepth: 1
33
34 overview
35 tools
36 advanced