Deploy with Unit Test

I wish to use VSTSForDP to support my pre-existing unit tests. Currently the process we use is anytime we make a change to the database schema we use SQL management studio to generate a script that will create the database. We then check that .sql file into TFS as a solution item. Our unit tests have a piece of init code that reads in the .sql file and executes it against our test server to create a fresh database that our unit tests will use.

We wish to simplify this process using DataDude. When our Unit Test init code runs I would like to run the .sql file that is the result of the build on our DataDude project. How can I do this? With a solution item I can use the test run config to make that solution item deploy along with the unit tests. What is the process I should use to access the build output from my DataDude project from my unit tests?

[870 byte] By [Optikal] at [2008-3-5]
# 1

For RTM, we will provide the ability to add a reference to a DBProject and have that project built/deployed as part of the unit test environment setup before any unit test execution.Unfortunately, this feature was not complete in time for the TechEd release.

The feature will work like this:

· Select the test project

· From the Test main menu, select Database Test Configuration…

· From this dialog, you will be able to configure the DBProject build configuration.

· Click save – the configuration will be persisted to the project’s app.config (relative path to the selected project file plus settings)

At test execution, the schema update will be deployed as part of the Assemble Initialize (you can see this method in the DBTestProvider.cs/.vb) before the population is executed.

Today, you could do this yourself by interacting directly with the MSBuild engine in the assembly initialize.In the CTP release, the configuration dialog does store the relative path to the selected project file, but we are looking at adding a specific section to store this information for RTM.

J.D.Laflen at 2007-8-30 > top of Msdn Tech,Visual Studio Team System,Visual Studio Team System - Database Professionals...
# 2
So I'd like to try your suggestion of calling out to MSBuild to build the .sql file at runtime. I'm not very familiar with MSBuild. When I try to just do an MSBuild passing in the .dbproj file it fails with a bunch of errors. I'm assuming I need to specify some number of parameters to MSBuild. Can you give me a sample command-line that I could use to call MSBuild manually on my dbproj?
Optikal at 2007-8-30 > top of Msdn Tech,Visual Studio Team System,Visual Studio Team System - Database Professionals...
# 3
I managed to get it to build via command-line. Is there a way to pass a property that will redirect the output .sql file to a directory of my choosing? Also are there any reference docs on the SqlBuildTask?
Optikal at 2007-8-30 > top of Msdn Tech,Visual Studio Team System,Visual Studio Team System - Database Professionals...
# 4

We are working on documentation for the build tasks, but they are not there now.Unfortunately, right now you cannot redirect the output of the build task or specify the input of the deploy task.We have just finished defining the inputs to the build tasks and these should be put into place by RTM.

J.D.Laflen at 2007-8-30 > top of Msdn Tech,Visual Studio Team System,Visual Studio Team System - Database Professionals...

Visual Studio Team System

Site Classified