Using Builders for test objects
Last week, Nat Pryce shared some good thoughts (and code examples) on using Builders for test data creation. His comments on how an Object Mother can be painful to maintain really resonated with me and mirrors my own experience.
As he points out, using an Object Mother can really clean up test code, making tests much more readable and straightforward. The downside is that they can end up being brittle or many times the number of methods tends to explode, as minor differences are needed for different test scenarios.
Using Builders also cleans up test code, but can allow for differences in test data without the need for a new method for each scenario.
This entry was posted by Scott Vlaminck on Thursday, September 6th, 2007 at 10:18 am and is filed under Agile Processes. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.
[…] still been thinking about Builders so I dug into Groovy Builders and presented at the Groovy Users of Minnesota (GUM) meeting last […] ...on October 10th, 2007 at 10:22 am
[…] you have to use Java and can’t use Groovy - at least when you can’t sneak it in. Others think the […] ...on November 30th, 2007 at 4:54 am