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.
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.
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.
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!)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With