Unit Testing, Agile Development, Leadership & .NET - By Roy Osherove
First of all, I would like to thank Roy Osherove for his recent blog about dataFresh . Right away we
Ian:
True - It's not realy a "unit test" if you do DB work in there. It's an Integration test if anything. The problem is you are using the unit test framework to accomplish it so the lines feels a bit blurry.
I don't consider it a "smell" really. I think DB unoit testing (integration testing really) is essential for testing you data layer along with teh database because you need to make sure it works well with the database. Mocking the DB isn't realistic IMHO as it still leaves you with bugs you don't know about on the DB which you only find out in integration (unless you use something like SQL unit which is pretty hard to use right now).
You can read the article I'm pointing to find out more about my view on this, or you can download the first chapter of my upcoming book "The art of unit testing" fomr here:
http://the.artofunittesting.com which talks about what is the difference between unit and integration tests, among other things.
Roy.