TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Test-Driven Django Tutorial

94 pointsby eddie_the_headabout 13 years ago

9 comments

zacharyvoaseabout 13 years ago
+1 from me. We need more language and framework tutorials to be written with testing in mind. I wouldn't be surprised if the work from this was moved into Django's official documentation very soon.
ikaweabout 13 years ago
Hooray for more guides on testing in python! Although there are a lot of mostly-equivalent tools to what I've grown to love in Ruby-land, I think the most lacking thing might be a sense of arbitrary "best practice".<p>The zen of python states "There should be one, and preferably only one, way to do it", which I see at the level of a line of code; However, at a higher level, I always feel like there are dozens of ways to pattern something, and none with any particular community buy-in. This leaves my integration balancing awkwardly across several different authors ideas of how things should work.<p>What can we do about it - How can we make the python community more opinionated? The desired end result is that software is less surprising, that common problems have a readily accessibly, highly compatible solution.<p>Maybe we need more snobs in Python? ;)
numlockedabout 13 years ago
Unfortunately the first thing that jumped to mind when clicking through was this: <a href="http://grokcode.com/746/dear-python-why-are-you-so-ugly/" rel="nofollow">http://grokcode.com/746/dear-python-why-are-you-so-ugly/</a><p>I realize it's a almost self-consciously ugly and it's a development tutorial, but still - a little CSS &#38; typography goes a long way.
评论 #3997885 未加载
leetroutabout 13 years ago
That is a great resource. Especially pulling Selenium into the picture and showing good functional testing. Thanks to the author for putting this together.<p>While I understand the need to show how unit tests work do we really need to test Django's ability to save records to the database and retrieve them in part 1? I personally don't follow true TDD, especially with model fields. Am I off in left field? Is this pattern common with other developers? Or perhaps people test for a fields existence by checking _meta.fields?<p>The example of testing a specific attribute, verbose_name, (that is expected to be altered by the user) in part 2 and the user implemented __unicode__ method test I do think is a great example, though.<p>I like Daniel's summary in the "What To Test?" section at <a href="http://toastdriven.com/blog/2011/apr/10/guide-to-testing-in-django/" rel="nofollow">http://toastdriven.com/blog/2011/apr/10/guide-to-testing-in-...</a>
评论 #4002699 未加载
评论 #4002685 未加载
jayliewabout 13 years ago
I'm a Django guy who started picking up some Rails out of curiosity, and that's when I realized how great TDD, specifically, automating behavior-driven testing is in general .. and I was wondering why it didn't seem like a prominent thing in the Django community. Thanks for doing this, please do continue!
评论 #3997747 未加载
mattdeboardabout 13 years ago
A couple of great tutorials on testing in Django is <a href="http://toastdriven.com/blog/2011/apr/" rel="nofollow">http://toastdriven.com/blog/2011/apr/</a>.
kvnnabout 13 years ago
I've been wanting to do TDD for my newest project, and hadn't searched for docs yet. Thank you, I'm using this now.<p>Using the core Django tutorial was a great decision. Being able to recycle things that I already know, rather than learning new things (even simple tutorial steps), is nice.
评论 #4002422 未加载
dcesielabout 13 years ago
I recently started learning Django for a project I'm working on. I've been reading the django book at djangobook.com, but it doesn't really talk about writing tests. This is awesome, every Django developer should know how to do this.
评论 #3996938 未加载
hjwp3about 13 years ago
thanks for the post! (harry, the author)