small refactr logo
At refactr we believe in the value of connection, the utility of agile processes, and the power of great ideas. We are creating the next generation of software for people who expect more from their web applications.
refactr
« The Parable of the Two Programmers | Indian firm hiring programmers in the U.S. »


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.

Further Discussion (2 Responses so far. Add yours)

  1. refactr Blog Archive » Groovy Builders said...
    […] still been thinking about Builders so I dug into Groovy Builders and presented at the Groovy Users of Minnesota (GUM) meeting last […]

  2. The best Markup Builder I could build in Java at Stephans Blog said...
    […] you have to use Java and can’t use Groovy - at least when you can’t sneak it in. Others think the […]

Join the Discussion