Follow @RoyOsherove on Twitter

I changed my mind - Mock objects are wrong for database unit testing

More than a year ago I wrote about the problems in database testing. I also stated that I feel it's totally wrong to run your unit tests against a live test database, but instead you should be using mock objects to save you from all the trouble.
Boy have things changed since then. I take back what I said. For a long time now I've been doing DB testing without mock objects, because I believe that's currently the best way to make sure you test data access logic and integration with the database procedures and views.
There are now several easy to implement solutions to the "how-the-hell-do-I-roll-back-the-changes-i've-made-to-the-db" problem(see this article, mbUnit , xtUnit and this one about extending the new Nunit as well for several options for doing the same thing).
With those - there's no reason for you not to do it.
Funny how things change overtime. Like any other thing, but usually more, software development is one of those things that looking back 6 months from now I'll always say to myself "Gosh! if I knew then what I now!"..

What I look like (kinda)

Godwin's Law