tSQLt
tsqlt.org
- Free plan
- Self-hosted
What tSQLt is
tSQLt is a free, open-source unit testing framework for Microsoft SQL Server that lets database developers write tests in T-SQL. Tests run inside transactions, helping keep them independent and reducing cleanup work. Developers can group tests in schemas and use those schemas for common setup methods. To isolate code under test, tSQLt can fake tables and views and create stored procedure spies. Its user guide includes assertions such as AssertEquals and AssertEqualsTable, and results can be produced as plain text or XML for continuous integration tools. The project says it works with SQL Server editions from SQL Server 2005 Service Pack 2 onward, and its repository identifies the license as Apache 2.0. Installation involves running PrepareServer.sql once per server with SA permission, then installing tSQLt into a development database. The quick start says not to install it in production. Redgate SQL Test is named as the preferred SSMS plug-in for running tests through a graphical interface.
Who it suits
It suits SQL Server database developers who want to use unit testing and test-driven development in database work. Teams using continuous integration can use its plain-text or XML test output.
Good to know, and what to watch
- Write unit tests in T-SQL.
- Tests run in transactions.
- Can fake tables and views to isolate code.
- Produces plain-text or XML output for CI tools.
- Free and licensed under Apache 2.0.
- Installation requires SA permission.
- The quick start says not to install it in production.
- Requires a self-hosted Microsoft SQL Server environment.
Plans
Every plan and pricetSQLt
Free plan
The verdict
tSQLt provides SQL Server developers with database-focused test organization, isolation, and CI output. Its setup requires server-level permission, and it should be kept out of production.
What the maker publishes
- Assertions
- The user guide includes assertions such as AssertEquals and AssertEqualsTable. source
- Audience
- The site describes tSQLt as a way to bring unit testing and test-driven development to SQL Server database development. source
- CI output
- Test output can be generated as plain text or XML for integration with continuous integration tools. source
- Dependency isolation
- The framework can fake tables and views and create stored procedure spies to isolate tested code. source
- Downloads and source
- The downloads page offers the latest release, a version for SQL Server 2005 and currently Azure SQL Databases, and source code with tests. source
- Installation
- The quick start says installation requires running PrepareServer.sql with SA permission once per server, then installing tSQLt into a development database. source
- Installation
- Installation uses the included tSQLt.class.sql script in a development database. source
- Integration
- The downloads page names Redgate SQL Test as its preferred SSMS plug-in for running tSQLt tests through a graphical interface. source
- Integrations
- The site identifies Redgate SQL Test as its preferred commercial SSMS extension and the official SSMS plug-in for tSQLt. source
- Isolation
- The framework can fake tables and views and create stored procedure spies to isolate code under test. source
- License
- The official repository identifies the license as Apache 2.0. source
- Organization
- Tests can be grouped in schemas, which also allow common setup methods. source
- Production limit
- The quick start says tSQLt should never be installed in production. source
- Production limitation
- The quick start says tSQLt should never be installed in production. source
- Purpose
- tSQLt is an open-source unit testing framework for Microsoft SQL Server. source
- Purpose
- tSQLt is an open source framework for unit testing SQL Server databases with tests written in T-SQL. source
- Security setup
- The PrepareServer.sql script enables CLR and installs a server certificate for tSQLt CLR; executing it requires SA permission and needs to be done once per server. source
- SQL Prompt support
- The site offers a set of snippets for Redgate SQL Prompt to make working with tSQLt easier. source
- SQL Server compatibility
- The project says tSQLt works with all SQL Server editions from SQL Server 2005 Service Pack 2 onward. source
- SQL Server compatibility
- The site says tSQLt is compatible with all SQL Server editions from SQL Server 2005 Service Pack 2 onward. source
- Support and community
- The quick start points users to the tSQLt mailing list, GitHub, Stack Overflow, and the SQL Server Community Slack #tsqlt channel. source
- Support and learning
- The quick start links to a mailing list, GitHub, Stack Overflow, and the SQL Server Community Slack #tsqlt channel. source
- Test language
- It lets developers implement unit tests in T-SQL. source
- Test organization
- Tests can be grouped within schemas so teams can organize them and use common setup methods. source
Checked against the maker's pages on 5 Oct 2026.