Geeks With Blogs
Adrian Hara Working through the .NET maze

I'm actually somewhat amazed that there are only 16 downloads (or so CodePlex says) for the 1.0 release of AutoFixture. I had heard about it a while ago, but due to lack of time didn't actually get a chance to try it out until today. Please, PLEASE don't make the same mistake in delaying getting and using it for as long as I did, because frankly, it rocks.

I won't go into details on what AutoFixure is, except say that it will help you write better, cleaner unit-tests and also because I wouldn't do nearly a good job at explaining it as the following amazing (series of) posts:

One experience I can share though is that, after a couple of hours of using and loving it I found that as the complexity of the code and tests go up, moving from just using the Fixture class directly to inheriting from it and customizing a specific fixture class for the particular SUT brought a HUGE improvement, both in dropping the number in lines of code by almost half and making the tests crystal clear. This is also summarized in one of the posts referenced above, though only briefly: "The more complex and demanding your SUT's API is, the greater the gain from using AutoFixture will be, since it's going to figure out much of the routine stuff for you." While this is certainly true, I'd add that customizing the Fixture for your particular case with an appropriate API can really make your tests easy on the eyes of future readers (which, of course, might be you :))



Posted on Monday, February 8, 2010 3:13 PM | Back to top

Comments on this post: Autofixture - better, cleaner tests

No comments posted yet.
Your comment:
 (will show your gravatar)

Copyright © Adrian Hara | Powered by: