tags:

views:

641

answers:

2

Hi, all.

I have read a lot of essays talking about benifits TDD can bring to a project, but I have never practiced TDD in my own project before.

Now I'm starting an experimental project with Django, and I think maybe I can have a try of TDD.

But what I find now is that I don't even know how to answer the question "what should I put in my test cases?".

Please tell me how should I plan TDD in a project, in this case, a web project based on Django.

Thanks.

+4  A: 

Your first step should be to read over the django test documentation...

http://docs.djangoproject.com/en/1.1/topics/testing/#topics-testing

After that your first test should be as simple as

  • Create a test client
  • Issue a request for your intended main page
  • check the return status code is 200

now run your test, and watch it fail because you don't have a main page yet.

Now, work on getting that test to pass and repeat the process.

Fraser Graham