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