How to re-deploy, re-create database on each test run

Viewed 5572

Currently I'm using Visual Studio 2012 RC and SQL Server 2012 RTM.

I'd like to know how to re-deploy/re-create a test database for each test run.

Keep in mind I've a SQL Server database project for the database using Visual Studio 2012's template.

Actually I'm not very sure about an idea I got in my mind, but .testsettings file has Setup and cleanup scripts. Is this the way to go? For example, a PowerShell script reading the database project generated script and executing it against the database?

I guess there're better ways of doing that and it should be an out-of-the-box solution but I ignore it and Google doesn't help me in finding the right solution.

3 Answers
Related