Unit Tests Debate

Debate on the value and effectiveness of unit tests compared to integration and end-to-end tests, with critiques that unit tests are often wasteful, brittle, or less useful than broader testing strategies, supported by personal experiences and article references.

📉 Falling 0.3x Other
4,280
Comments
20
Years Active
5
Top Authors
#3991
Topic ID

Activity Over Time

2007
11
2008
52
2009
119
2010
96
2011
96
2012
142
2013
101
2014
217
2015
139
2016
300
2017
364
2018
256
2019
297
2020
445
2021
295
2022
369
2023
420
2024
306
2025
251
2026
4

Keywords

LOT IF IMO LONG Waste.pdf us.com AND HARD kentcdodds.com HUGE tests unit tests unit test integration testing unit testing code e2e unit test

Sample Comments

h0l0cube Aug 23, 2023 View on HN

This is much better critique of the value of unit testshttps://rbcs-us.com/documents/Why-Most-Unit-Testing-is-Waste...

camgunz Jul 8, 2020 View on HN

I’m bearish on unit tests as well. Integration and e2e tests get you closer to the spec and are easier to change when the spec changes or your product inevitably evolves. I reach for unit tests when something is foundational or hairy, but IMO they should be a last resort. They fill your application like sand in gears otherwise.

shados Oct 27, 2017 View on HN

I go the complete opposite way.I've tried various testing strategies over 15~ different companies in all sorts of environments, and unit tests are the only thing that really work (IF you can convince the team to do it...and that's a big IF).The article starts with a point I agree with: the lower in the pyramid, the cheaper the tests but the lower the confidence level they bring. That's true.Where I disagree is how much the difference on confidence and cost are.I can ba

siva7 Jul 28, 2021 View on HN

i hear this often but i don’t think it’s true. sometimes a good integration test will do you more favour than a dozen of unit tests. also unit tests can be a pain in the ass as a bad integration test

julsonl Jan 18, 2017 View on HN

In my experience, it's usually not the existence of unit tests themselves that's causing an issue, but that most of them are badly written. One telltale sign is when writing the unit test becomes overly painful (like too much code setting up mocks), it usually means that your class is not simple enough or has too many dependencies.Proper unit testing also complements integration testing in that corner cases can be handled at the unit test level, therefore reducing the amount of inte

skydhash Aug 21, 2025 View on HN

Unit tests value is mostly when integration and more general tests are failing. So you can filter out some sections in the culprit list (you don’t want to spend days specifying the headlights if the electric design is wrong or the car can’t start)Having a lot of tests is great until you need to refactor them. I would rather have a few e2e for smoke testing and valuable workflows, Integration tests for business rules. And unit tests when it actually matters. As long as I can change implementat

recursivedoubts Feb 15, 2025 View on HN

Agree w/the author that the concept of "unit" often hurts test quality.You should be striving to balance the long-term usefulness of your tests with the debuggability of those tests. In my experience, those tests are what most people would call "integration tests" (although that name, like so much terminology in the testing world, is confusing and poorly defined.)You want to get the tests up at as high a level of abstraction as possible where the API and correctne

notacoward Feb 24, 2020 View on HN

I keep running into the exact inverse: people who seem to believe they only need unit tests (i.e. no functional/integration tests). It's insane. If I had to pick one, I'd go with the more "live" multi-component tests and ditch the unit tests. Unit tests still have value, as a lightweight way to catch dumb errors in future refactors. That's fantastic. Love it. As soon as they cease being lightweight (and the norm seems to be more effort spent creating mocks&#x

bob1029 Oct 30, 2024 View on HN

I've always looked at unit tests as a targeted and often temporary measure.Once you have a way to do a good integration/e2e test, the results of the constituent unit tests don't provide as much value.I'd rather run one big complicated thing for real once than hang my hat on a bunch of fake green checkmarks that update every 50 milliseconds.

bluejekyll Dec 31, 2015 View on HN

I'm sorry, but what?!Unit testing is not an exercise in the mundane by making your manager happy, it is about validating that the thing you just wrote actually works, so that you can move on to the next thing, eventually aggregating all of that work together and constructing code that works!As others have said, you test inputs and outputs (and maybe you need to test some failure modes depending on the complexity of the situation). When you're working on a parser, or lexical analy