29 January 2008

Object Mothers

When you are writing unit tests for a system, you need often a lot of test data. The creation of the data takes place in the test fixture. If I want to test the handling of a order then I need to create a customer, products, categories, shipping and so on. That is test data only for a order. But you want also test customer. And Product. For those classes you also need test data. Why don't reuse the test data of order. Well this paper about object mothers is very interesting. And we use it in your project.
And this book about unit testing, xunit patterns is a recommendation.

No comments: