TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

TDD django Tutorial

83 点作者 urlwolf将近 13 年前

4 条评论

igorgue将近 13 年前
I got until <i>Unit testing the verbose name for pub_date</i> that's not needed, nor you should unit test that, what are you testing? That functionality or 'unit' you didn't write and I bet is a test in Django.<p>And then it goes on and on about testing things like 'relationships'.<p>I've been running away from setUp and TearDown because they ruin test readability (maybe I'd just stick in the selenium browser).<p>Also most of the unit tests written there are not running in isolation which means... they're not unit tests! Those are integration tests.<p>If you base your tests in the techniques described there you are going to end up with a very slow test suite and very fragile tests (meaning stuff breaks where it shouldn't break).<p>I like to run:<p>nose: to run tests as functions not classes pinocchio: to see specs in color nose-quickunit: to find changes in my repo and figure out what test to run (when not TDDing) coverage: stats mock: mocking library<p>And my tests look like this:<p><a href="http://cl.ly/1R2T0G282h1z331C1A2Y" rel="nofollow">http://cl.ly/1R2T0G282h1z331C1A2Y</a><p>or like this:<p><a href="http://cl.ly/20263T1y2s402B1v2D3R" rel="nofollow">http://cl.ly/20263T1y2s402B1v2D3R</a><p>I think they're very pretty and run fast :-)
评论 #4036808 未加载
评论 #4034915 未加载
评论 #4035057 未加载
k_bx将近 13 年前
It's a fantastic tutorial and I hope everyone will start testing their code at least with selenium. But.. it's still not unit-testing (and not TDD) at all. And in things like this, when you break something at the bottom, tons and tons of tests will break.<p>In unit-testing tests are glanular, units are small, and you build a pyramid small step after small step.
评论 #4035823 未加载
评论 #4037224 未加载
kmfrk将近 13 年前
I'm sure it's a great tutorial, but the font is basically illegible in Opera on Windows 7.<p>A `max-width` rule in CSS would be great as well.
评论 #4036785 未加载
idleloops将近 13 年前
<a href="http://news.ycombinator.com/item?id=3996328" rel="nofollow">http://news.ycombinator.com/item?id=3996328</a>