Introduction — Django: Sane Testing v0.4.0 documentation

### Navigation

- index
- next |
- previous |
- Django: Sane Testing v0.4.0 documentation »

# Introduction

Django: Sane Testing is a Python library for the Django framework that makes it possible to test.

As much as I like some Django concepts and as much as authors embrace testing in official documentation, I doubt that anyone really tried them in detail. Some basic testing techniques are impossible with Django and this library comes to fix them.

One of the great flaws is very simplistic testing system. By it’s nature it’s very slow (flushing database when not needed [1]), it does not allow some basic xUnit features and also do not allow testing via HTTP [2] and provides to extensibility model to fix the issues.

However, there is an excellent option available. Nose library is excellent test-dicovery framework, backward-compatible with PyUnit, that provides nice plugin interface to hook your own stuff. To make my life simpler, most of this library is made as a nose plugin.

And don’t be afraid, we have TEST_RUNNER too, so your `./manage.py test` will still work.

## Feature overview

Library supports following:

- Nose integration (load plugins and try `noserun`)
- Django integration (`./manage.py test` and boo ya)
- True unittests (no database interaction, no handling needed = SPEED)
- HTTP tests (you can test with urllib2)
- Transactional database tests (everything in one transaction, no database flush)
- Selenium RC integration (our pages needs to be tested with browser)
- CherryPy can be used instead of Django ‘s WSGI (when you need usable server )

Footnotes

[1] | At least transactional test cases are going to be implemented in Django 1.1, see #8138.

[2] | Kinda buggy when we’re talking about HTTP framework. See #2879.

### Navigation

- index
- next |
- previous |
- Django: Sane Testing v0.4.0 documentation »