Where to put common setUp-code for differen testclasses?
问题 I have several different test classes that require that certain objects are created before those tests can be run. Now I'm wondering if I should put the object initialization code into a separate helper class or superclass. Doing so would surely reduce the amount of duplicate code in my test classes but it would also make them less readable. Is there a guideline or pattern how to deal with common setUp-code for unit tests? 回答1: Patterns and practices when dealing with test code is no