Your Object Mama

December 12, 2007 Pivotal Labs

I’m more and more convinced that Object Mothers are the way to go to manage test data. I owe my introduction to this pattern to David Goudreau.

A few users and items in fixture data so that you can start up your application and test without adding things from the UI… and then let your tests be self-sufficient: make an Object Mother that generates objects for you with sensible defaults. Instead of relying on fixtures, you know you have an object that nobody else will change. Excellent for reducing test fragility.

It can make builds a bit slower, but the test robustness is worth the tradeoff to me.

I’m busy adding it to my Selenium Tests today and basking in test robustness.

About the Author

Biography

Previous
OpenSocial
OpenSocial

Okay, it's not ready for prime time. But it was entertaining digging into OpenSocial and making some gadget...

Next
Pivots at RubyConf
Pivots at RubyConf

The Confreaks site has released a slew of videos from the 2007 RubyConf. The videos are in the perfect form...