DEV Community

Discussion on: Unit Testing - is it necessary

Collapse
 
history_dev profile image
History Dev

Kent Beck's book on Test Driven Development is a good place to start on this subject.

I think in terms of the things you've mentioned we're beyond the scope of pure unit tests. You'd have to do a lot of mocking, and dependent on what is under test they'd need to be backed up by integration tests to generate confidence. So I agree with you in many ways.

The reason unit tests, and TDD in particular, help with code design is because they push you towards code isolation. They drive you to abstract domain logic away from I/O and orchestration, because the code becomes easier to test. This also reduces code complexity, makes debugging easier, and increases confidence.