Automating database tests with Visual Studio and Team Foundation Server

This is the third post in the series about database development and testing using SQL Server Data Tools and Team Foundation Server.

Post 1 : Continuous Integration with SSDT and TFS

Post 2 : Unit testing with SQL Server Data Tools

You can run test in Visual Studio to test the quality of your build. In VS 2012 and 2013 there are 5 kind of tests that are available for the user:

1. Unit tests

2. Coded UI Tests

3. Web performance tests

4. Load tests

5. Generic tests

These tests are often called smoke tests or build verification tests (BVT).

Software requirements

You will need Visual Studio 2010, 2012 or 2013 and at least Professional edition to be able to run unit tests. SQL Server Data tools integrated shell is not enough.

Configure and run scheduled tests after successfully building your Application

When creating Build Verification Tests you need to use Visual Studio, Version control and Team foundation Build (msbuild). First of all you need to write your tests, check them in with Version control. In the build definition file you can then choose which test to execute. You can then queue a build or use continuous integration to run the tests upon a successful build.

The steps to achieve that are simple:

· Define and check in a Build Definition Test

· Create a build definition

· Add the computer to TestBuildController user group

· Setup the build agent

· Run the BVT build definition

Define and check in a Build Definition Test

If you remember from previous post, I created a simple unit test to check if my continuous deployment script had worked correctly.


Figur 1 Very simple test script

Now I want this script to run as part of my checkin process after the database has been deployed to my integration instance.

Read more on SQL Shack site :

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: