Close
Glad You're Ready. Let's Get Started!

Let us know how we can contact you.

Thank you!

We'll respond shortly.

LABS
Your Object Mama

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.

Comments
  1. Yossef says:

    This could be seen as blog-pimping or link-spamming or whatever, but I think you might well be genuinely interested in reading about [“Object Daddy”](http://b.logi.cx/2007/11/26/object-daddy). (Be prepared. It’s a long post.)

  2. Shifra Pride Raffel says:

    Thanks, Yossef, looks interesting.

  3. Dan Manges says:

    Object Mother still has a fixture aspect to it. From Martin Fowler’s entry:
    > “At this point it makes sense to have a factory object that can return standard fixtures. Maybe ‘John’, an employee who just got hired last week; ‘Heather’ and employee who’s been around for a decade.”

    I think this differs a little bit from a (http://www.dcmanges.com/blog/38) that provides reasonable defaults.

  4. Dan Manges says:

    Although, it does seem like Object Mother has become a subjective term. From xUnit Patterns:

    > “Because there is no single, crisp definition of what someone means when they say “Object Mother”, it is advisable to refer to the individual patterns (such as Automated Teardown) when referring to specific capabilities of the Object Mother”

Post a Comment

Your Information (Name required. Email address will not be displayed with comment.)

* Copy This Password *

* Type Or Paste Password Here *