Simple tests lead to good design
In my experience, the most common cause of complex or repeated test setup is
a class that's doing too much work. Altering the design to facilitate test
simplicity leads to a more loosely coupled system
Simple design leads to good tests
A loosely coupled design allows you to test the edge cases on any class without
worrying about setting up an unrelated class. All other things being equal, A
tester that doesn't have to deal with a clustered, complex system will come up
with better test cases than one that does.
I'm curious about the interaction between these two premises. Particularly, I think
the following feedback cycle exists, and is useful:
complex test setup -> design improvement -> find more test cases -> complex test setup
Further, if this were your only design technique (ie: you only altered your design when
it simplified some tests) what would your system look like? Would it look like a good design?
If not, what other techniques do you need to produce a good design?
I would be happy to facilitate a discussion around these ideas with anyone who's interested.