I’m new both to Django and unit testing but since I’m starting a project after a fair amount of time playing with the framework I decided to give unit testing a shot.
My enthusiasm aside, I am pretty lost as to how to plan the developing process. I did a little search in github for Django projects that use unit testing and I stumbled upon this. I see there are only tests on the “tagging” app, and it looks good but I have no idea how to break it down. Why the “models.py” file in the apps/tagging/tests/? The model classes there have nothing to do with the ones in apps/tagging/models.py …
Any ideas on how to figure this out or find a good example on how to implement unit testing into a django environment ?
Also, I read in the docs that Django introduced unittest2 in 1.3 so would “Django 1.1 Testing And Debugging – by Karen M. Tracey” be a helpful reading or do you think it could cause some confusion?
Anyways, I appreciate any input in advance.
If I may plug my own tutorial, it covers how to do TDD in Django from the ground up. I cover the same steps as the “official” Django tutorial, except using TDD every step of the way. That includes full browser-automation testing with Selenium (which allows you to test behaviour from the end-user’s point of view, including the possibility of including javascript later). I also show how to use the Django TestClient for unit testing…
http://tdd-django-tutorial.com