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.
Pingback: refactr Blog Archive » Groovy Builders
Pingback: The best Markup Builder I could build in Java at Stephans Blog