Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to start doing TDD in a django project? [closed]

Tags:

tdd

django

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.

like image 823
satoru Avatar asked Jan 06 '10 14:01

satoru


People also ask

What is TDD in Django?

Test Driven Development (TDD) is an iterative development cycle that emphasizes writing automated tests before writing the actual code. The process is simple: Write your tests first. Watch them fail. Write just enough code to make those tests pass.

Which command is used to start a Django project?

django-admin startproject <project_name> . So for example, for every Django project you start, you can run the following command: django-admin startproject config . Try each command on your own, and decide which one is the best for you.


1 Answers

I've started writing a tutorial on the topic. It covers pretty much all the steps in the official Django tutorial, and it includes full browser-automation testing with Selenium, so you can test javascript too...

http://tdd-django-tutorial.com/

(sources at https://github.com/hjwp/Test-Driven-Django-Tutorial)

[edit 2013-04-15] I'm now writing a book for O'Reilly on the topic. IMO it presents things in a much better way that my old tutorial. Check it out at

http://www.obeythetestinggoat.com/

(it's still free if you want it to be!)

like image 183
hwjp Avatar answered Sep 21 '22 05:09

hwjp