Hacker News new | ask | show | jobs
by davelnewton 4006 days ago
Some unit testing might be a joke, but not all unit testing. If you have small units-of-work they should be tested, or at least testable.

Integration testing often makes a lot more sense, though.

1 comments

I believe I'm in the minority, but I think unit tests are nearly universally worthless - exceptions being those for well defined APIs (eg math). Good unit tests must have an independent oracle of truth or else you aren't testing anything. As a practical matter you should only write tests for code that materially impacts the business (or you are just wasting everyone's time ). Instead of writing regression or integration tests, which are hard (hence the need for testing), people absent mindedly write unit tests and point at code coverage.
I'll need concrete examples of good/bad tests to have any idea what you're talking about at this point. You say they're worthless but then say they're good for well-defined APIs, which is precisely what unit tests are for.