Test Vews

 Practical Django test example: View

This is the fourth in a series of Django testing posts. Today is the start of a sub-series, with real examples. This series will go through each of the different types of tests in Django and show how to do them. I'll also try to point out what you want to do to make sure you're getting good code coverage and following best practices.


Instead of picking up some fancy model and perspective, I thought I'd do something a little more useful. I'm going to take one of my favorite open source Django apps, and write some tests for it! Everyone loves to get patched, and patching that test is a god send. So I thought I could do a tutorial and give back to the community at the same time.


So I'm going to write some tests for Nathan Boror's BASIC blog. This could also be the code that powers my blog here, with some slight modifications. So it's a win-win for everyone involved, just as it should be.


Nathan's app has already done some basic view testing. He was kind enough to allow me to speak publicly about his experiment. He claims to be a designer, and not a good coder, but I know he's great at both. So we're going to talk about testing his view today, and then go ahead and test some models and template tags later.

Comments