Unit tests considered harmful? No

Unit tests considered harmful? No…
I stumbled across this post today, which represents (I think) a widely held belief that unit tests are bad. The argument here seems to be: Unit test coverage doesn’t guarantee that features actually work, only that regressions can be caught Tests make code difficult to change

Read in full here:

This thread was posted by one of our members via one of our news source trackers.

One of the main things that unit tests have helped us in a lot of our projects is avoiding regression.

1 Like

They’re not necessarily bad, but a lot of devs become obsessed with them and write far too many unit tests, in a way that couples the test very tightly with implementation details and often leads to mock hell.

Personally I prefer to have a small number of (helpful) unit tests, with integration tests that usually provide much greater reward on investment AND less brittle tests.
I’d like to see more property-based tests too but it’s not always obvious how and when to use them.

1 Like