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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

I don’t believe I have to say that Unit tests are good for you

2 点作者 victorronin超过 2 年前

2 条评论

osigurdson超过 2 年前
&gt;&gt; Why unit tests are good?<p><pre><code> Regression testing </code></pre> In my experience in a heavily tested code base (unit and integration), this is more of the role of integration tests. However unit tests are ultra valuable for code that has few dependencies. The higher you go in the stack the muddier it seems to get.
throw310822超过 2 年前
&gt; if he spent barely 20 minutes writing 3–4 trivial unit tests for this function, we would have saved probably 6 hours each ... The math was beyond simple. 20 mins invested and 12 hours saved.<p>I&#x27;ve heard this reasoning before. The math is simple but wrong. The cost of writing unit tests must also include the time spent on tests of stuff that was never broken; and for the maintenance of tests that break because of new features or bug fixes rather than actual code issues.<p>Unit tests are very useful, essential, in some situations. In others they&#x27;re a waste of everybody&#x27;s time.