4 ms·
I find this is always bean counting... in fact imo most unit testing should be about module boundaries, and not every single function (but fully admitted, that
by throwbadubadu 4y ago
I find this is always bean counting... in fact imo most unit testing should be about module boundaries, and not every single function (but fully admitted, that picture changes a bit with functional languages), because that is what is most reasonable.
Whoever said that unit testing is about testing your most smallest bits only and you need to test your smallest program decompositions?? (And by that logic, why not test each individual line, or each individual expression???)
Because composition also counts and you anyway need to test it, but instead hordes of programmers write unit test with bad mocks that only test unnecessary implementation detail and get fully in the way of any reasonable refactoring, but composition, functional behaviour is not tested.
So imo it is all about definition of what is a unit: It can be your one complicated algorithm heavy function, it can be a whole module at its module interface, it can even be x modules together achieving together a functionality/behaviour.
I can only roll eyes at people who try to tell other people what a unit test is and what not, and what is "wrong" unit testing.. I would hope we'd more distinguish bad vs good testing instead discussing about what is unit and what is integration testing... and most of the time bad tests stem from the crowd wanting to tell what is a unit test and what is not, tbh.