October 2014
One other thing I have found in the past: giving in to the urge to group tests too early can keep you from letting your test suite tell you that your object has a too big interface. Surely there are classes complicated enough to warrant all that has been said above, but an overlong test case can just as well be a smell caused by a single responsibility violation.
1 reply
October 2014
▶ timfischbach
I find this a matter of personal preference. Some people like to put everything in one place, then look for signals about it growing too large. Others, like me, prefer to build many little things, then look for signals about ideas being scattered too widely. I find that knowing one's preference and which signals to watch out for matters than choosing either extreme.
As you say, we can detect a SRP violation by a large test suite, but we can also detect that by duplication in the names of test case groupings.