builder - Best practice for object creation in unit tests? -


for unit tests need lot of specific, large (many fields) objects. need multiple different instances testclasses. far know have few options , wondering best:

  • extend constructors of classes risk telescoping pattern
  • write methods in each testclass create object me
  • implement builder pattern, lose lot of time refactoring application
  • use utility classes create objects me based on given parameters

i think best option use builder pattern, difficult since don't have lot of time refactoring. think next best thing using utility classes. practice or better options? aplogize if primairly opinion based.

to me sounds you'd benefit abstract factory pattern. you're suggesting in last point.

there's nothing wrong creating specific factory tests.


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

How to get multiresult with multicondition in Sql Server -