How unit tests reveal bad architecture

Unit tests are something awesome: they not only tell you if your changes will break everything but also when you need to mock out 10 dependencies you know something is wrong.

Having to mock out too many dependencies will make people less likely to write proper tests for it. Seems like writing tests is hard enough for your average developer so why make it harder ? I don’t have an upper limit on how much mocks are too much but when someone says “I don’t want to test this, I’ll have to mock half of the system”, that’s when you’ve gone over the limit. That’s when you should start splitting into sub-systems.

Something are better left to integration tests also; indeed I don’t think everything needs to be unit tested. At one point everything has to work.