In most products whether its a Large Hosted WebSite or Shrink Wrapped product with a DB, you usually have 2 scenarios you want to Unit Test (I understand this to some may cross over to much more than simply Unit Testing)
- The Fresh Install Path - When you create the DB from scratch
- Automating the DB Creation using MsBuild and SQLCMD, passing parameters in
- Use PowerShell for any Server Level Administrative stuff
- The Upgrade Path - When you are upgrading the DB of an existing customer
- Restore a backup of a cleansed Real World DB as your Baseline
- If necessarily apply upgrades after upgrades
- Again use PowerShell, MsBuild, SQLCMD to orchestrate the harness
For me, even when Unit Testing I like to test with "Real World" Data especially real world Volume of data, to catch issues as close to the Implementation Phase as early as possible. So in general I don't even do Mock Testing and go for a better Unit Testing Harness that can be rebuilt and run ondemand. Basically the Continuous Integration approach, or partial CI (oxymoron) approach.
Notice that if you take the Continuous Integration approach, what you are keeping in Mind even during Implementation and Development is the Automation of Deployment of the Deliverables/Release into Production. Basically keeping the End in mind from the very Beginning, because your new feature isn't worth a thing if its not easily deployable. This is especially the case when Big Data horizontal scalability today usually means you are separating Customers in different DB's and have to repeatably run the Deployment Scripts on several of those DBs, in a predictable fashion.
How many times has a Developer declared they are "done", but then you have no clue how to even start doing functional testing on it, because it can't be deployed to anywhere other than the Developer's Environment.
So the Unit Testing harness you are creating, really test not just your Code but also the Deployment Scripts. In general to achieve this I use Jenkins, MsBuild, PowerShell. And if browsers are involved I use VirtualBox for the VM to launch different browsers.