3 ms·
Yes this what has spread around and what people think of as unit tests. But it an awful way of splitting tests. Code bases following this end up with brittle te
by UK-Al05 6y ago
Yes this what has spread around and what people think of as unit tests. But it an awful way of splitting tests. Code bases following this end up with brittle tests, that break at slightest design change with no functional change.
Here's a good article kent beck retweeted on the subject.
https://twitter.com/KevlinHenney/status/1266383805520084993 https://twitter.com/KevlinHenney/status/1266383805520084993
I define unit tests as fast, and don't cross architectural boundaries, and operate on a well defined public interface. And test some kind actual property you care about. I don't follow "strict" rules like unit test per class, per function etc.
A lot classes just extract to some to some helper class, and they operate well together and the helper is not likely to be used anywhere else. Just make the helper class private and test as a unit against some actual desired property you want to test.
Integration tests is when you bring external things into the mix like databases, or http calls.
- afarrell 6y ago> just make the helper class private Yes, if your class is small enough to not make sense to test, make it private.