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

前端 未结 3 951
鱼传尺愫
鱼传尺愫 2021-01-05 14:11

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 m

3条回答
  •  时光取名叫无心
    2021-01-05 15:00

    As mentioned you'll probably want to use the VS 2012 .Local.testsettings > Setup and Cleanup scripts to create / tear down you SQL Server database.

    enter image description here

    For the script you may want to use powershell with a .dacpac (rather than just a T-SQL script), since you are using a SSDT project. Here's a link to some example code - in particular you may want to take a look at the 'Deploy-Dac' command.

    If you are unfamiliar with .dacpacs as the (build) output of SSDT-created database projects, take a look at this reference link.

提交回复
热议问题