Unit Testing with local version of database (Visual Studio, SQL Server).
Posted on 2009-05-19
At our company, we have a solution that has a project and a unit testing project. We have a unit teting database set up that we use to test the project. We have standard data that we have in the unit testing database at all times, and if our tests fail or change the data we reset the testing database. All of the testing of the data in the unit tests is done my coding the values we expect, so the data in the database must have those values.
Now, however, we are creating some additonal projects that we also want to unit test, but we have different data needs for each one and they will use the same database schema as the other. Basically we need more data. But if we add it to the unit testing library, then we will have to change many of our tests.
What I'd like to know is there a way to have a "virtual" database that would exist on our local computers, that we could intialize to what ever data we needed for what were are testing. It would have to be something that would pick up an changes made to the unit testing database, new files, stored procedure etc.
We are using SQL Server 2008, Visual Studio 2008 Team System and devleoping in C#.