Session

Unit Testing T-SQL with Visual Studio SQL Server Data Tools

The Data storage and processing workload for Visual Studio includes SQL Server Data Tools which is now fairly well known as a way to develop and source-control your database. Not so well-known are the unit testing tools you get access to with this feature.

Applicable to anyone using MS SQL Server that is looking for improving quality and reliability, this session explores how to build unit tests against your stored procedures, functions, triggers and any other T-SQL code. The test project is a standard MS Test project, but the test building experience is much different. You'll see how to generate the project and automatically stub out the T-SQL code to test your database objects. Each of the built-in test conditions will be explained and demonstrated; they include things like validating data set checksum, scalar values, execution time, schema, row count and more. Additionally, how to create your own custom conditions in C# will be demonstrated with a real-world example.

At the end of this session you will have the knowledge to create and use SQL Unit Tests, allowing greater confidence in a traditionally under-tested segment of your code base.

This is a significant re-vamp of a years-old presentation

Bob Crowley

Software Engineer, .Net

Portland, Maine, United States

View Speaker Profile