Where to put common setUp-code for differen testclasses?

Posted by Benedikt on Stack Overflow See other posts from Stack Overflow or by Benedikt
Published on 2011-03-18T15:59:40Z Indexed on 2011/03/18 16:10 UTC
Read the original article Hit count: 232

Filed under:
|

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?

© Stack Overflow or respective owner

Related posts about java

Related posts about junit