Get Started with tSQLt
Proposed session for SQLBits 2026TL; DR
Unit testing of application code is obvious for most applications developers. Why is it not as wide spread for database objects such as schemas, stored procedures and functions? In this session you will get started with the tSQLt unit testing framework.
Session Details
Developers have unit tested their code "for ages". But database developers not so much. With tSQLt we have a good framework to implement unit tests for our database code and our database schema.
Once we get used to working with tSQLt, we might be ready to adapt Test Driven Development (TDD) for our database development, but in this presentation, I will focus on just getting started with unit testing.
I will present an overview of tSQLt and demo some basic and some not so basic unit tests for database schema and for programmability objects, such as:
- Validate table schema
- Validate scalar values
- How to setup test data for unit tests
- Mocking tables and calls to other programmability objects
Once we get used to working with tSQLt, we might be ready to adapt Test Driven Development (TDD) for our database development, but in this presentation, I will focus on just getting started with unit testing.
I will present an overview of tSQLt and demo some basic and some not so basic unit tests for database schema and for programmability objects, such as:
- Validate table schema
- Validate scalar values
- How to setup test data for unit tests
- Mocking tables and calls to other programmability objects
3 things you'll get out of this session
Learn what a unit test is
Learn how to use tSQLt for creating SQL Server unit tests
Learn how to use Visual Studio database projects to create unit tests using tSQLt.
Speakers
Magnus Ahlkvist's other proposed sessions for 2026
An introduction to SQL Server database projects - 2026
Automation for DBAs and database developers - One Day Training Day - 2026
Everything you need to know about Temporal Tables - 2026
Learn about database projects in a day - 2026
SQL Noire – A Database Murder Mystery - 2026