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.

Should I write unit tests? Yes and I’ll tell you why.

11 pointsby jaredbrownover 11 years ago

5 comments

joshkaover 11 years ago
My favourite argument for unit testing comes from <a href="http://www.daedtech.com/intro-to-unit-testing-10-the-business-value-of-unit-tests" rel="nofollow">http:&#x2F;&#x2F;www.daedtech.com&#x2F;intro-to-unit-testing-10-the-busines...</a>:<p>&quot;Do you think the customer is going to get angry if you explain that part of your development process is to execute the code you just wrote to make sure it doesn’t crash? If the answer to that is “no, of course not, that’s ridiculous” then you also have the answer to whether or not a customer would care if you happened to automate that process.&quot;
评论 #7267502 未加载
_random_over 11 years ago
First step of unit testing is picking the correct language. Static analysis will eliminate the need for whole class of errors. Then apply code contracts. Consider extending your static analysis package of choice to add rules specific to your application. As the last step write unit tests to cover your core business logic - something the computer can&#x27;t figure out for you. Realizing that unit tests are basically poor man&#x27;s static analysis is the first step to becoming better at writing them.
krappover 11 years ago
If I have projects which were written without tests because I was an idiot and didn&#x27;t know &quot;running it and seeing that it works&quot; counted as a test, should I go back and write tests for what I already have or start testing on new code only?
评论 #7267485 未加载
benjohnsonover 11 years ago
Possible counter point: while the unit-tester is busy writing perfect software. I&#x27;ll be lazy... and perhaps I&#x27;ll beat them to market and will use the resulting money to perfect the software.
评论 #7265810 未加载
评论 #7265845 未加载
pixel67over 11 years ago
Test often, test soon good article