Home > Uncategorized > To mock the DB or not?

To mock the DB or not?

Is a good question.

From a purist point of view you mock the DB, it allows your tests to be written without the headaches about DB. But we have to unit test the stored procedures / queries using SQL Unit. And your database code is tested as a Unit. Also if you use a OR Mapper handling the mapping then probably Mocking is easier and you dont have to worry about using SQL Unit (assuming the OR Mapper is thoroughly tested).

A pragmatist throws away this notion of Unit tests when it comes to the Data Access Component and tries something like NDBUnit, Thycotic Database Scripter or MBUnit (Rollback) for repeatibility of the tests. What type are you a pragmatist or a purist? Do you believe uin Automated Unit Tests are just automated tests?

[Update] Prakash pointed me to this link. Its about "XtUnit . An Unofficial Unit Testing Extensibility Framework – Add new attributes to NUnit or MbUnit easily!"

Expert talk:

Roy Osherove’s blog

Steve Eichert’s blog – Talks the other way (purist)

Advertisements
Categories: Uncategorized
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: