
tSQLt
tSQLt is a free, open-source framework for testing Microsoft SQL Server databases.
What tSQLt is
tSQLt is a free, open-source framework for testing Microsoft SQL Server databases. Developers write unit tests in T-SQL and can group them in schemas, which also support shared setup methods. Tests run in transactions to help keep them independent and reduce cleanup. To isolate code under test, the framework can substitute fake tables and views and create stored procedure spies. Assertions include AssertEquals and AssertEqualsTable. Results can be generated as plain text or XML for continuous integration tools. The project says tSQLt works with SQL Server editions from SQL Server 2005 Service Pack 2 onward. It is self-hosted, and its repository identifies the license as Apache 2.0. Setup requires running PrepareServer.sql once per server with SA permission, then installing tSQLt in a development database. The quick start says it should not be installed in production. Redgate SQL Test is named as a preferred graphical SSMS plug-in.
Good
- Tests run in transactions to reduce cleanup.
- Schemas support grouping and shared setup methods.
- Fakes tables and views; creates procedure spies.
- Plain-text and XML output support CI.
- Free and open source under Apache 2.0.
Watch out
- Requires SA permission for server setup.
- Should never be installed in production.
- Self-hosted rather than a hosted service.
Who it suits
tSQLt suits SQL Server developers who want to write database unit tests in T-SQL or use test-driven development. It is intended for development databases, not production installations.
Verdict
tSQLt offers SQL Server teams a focused way to organize and isolate database unit tests. Its production restriction and server-level setup requirement are important to account for.
Plans and prices
From tSQLt's own pricing page, checked 5 Oct 2026.
| Plan | Price | What it gives you |
|---|---|---|
| tSQLt | Free | Open source database unit testing framework for SQL Server |
The facts
Each one read from tSQLt's own pages, with the date it was checked.
What it does
- Assertions
- The user guide includes assertions such as AssertEquals and AssertEqualsTable.checked 5 Oct 2026
- Audience
- The site describes tSQLt as a way to bring unit testing and test-driven development to SQL Server database development.checked 4 Oct 2026
- CI output
- Test output can be generated as plain text or XML for integration with continuous integration tools.checked 4 Oct 2026
- Dependency isolation
- The framework can fake tables and views and create stored procedure spies to isolate tested code.checked 5 Oct 2026
- 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.checked 5 Oct 2026
- Installation
- Installation uses the included tSQLt.class.sql script in a development database.checked 5 Oct 2026
- Integration
- The downloads page names Redgate SQL Test as its preferred SSMS plug-in for running tSQLt tests through a graphical interface.checked 4 Oct 2026
- Integrations
- The site identifies Redgate SQL Test as its preferred commercial SSMS extension and the official SSMS plug-in for tSQLt.checked 5 Oct 2026
- Isolation
- The framework can fake tables and views and create stored procedure spies to isolate code under test.checked 4 Oct 2026
- License
- The official repository identifies the license as Apache 2.0.checked 4 Oct 2026
- Organization
- Tests can be grouped in schemas, which also allow common setup methods.checked 4 Oct 2026
- Production limit
- The quick start says tSQLt should never be installed in production.checked 4 Oct 2026
- Production limitation
- The quick start says tSQLt should never be installed in production.checked 5 Oct 2026
- Purpose
- tSQLt is an open source framework for unit testing SQL Server databases with tests written in T-SQL.checked 5 Oct 2026
- 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.checked 5 Oct 2026
- SQL Prompt support
- The site offers a set of snippets for Redgate SQL Prompt to make working with tSQLt easier.checked 5 Oct 2026
- SQL Server compatibility
- The site says tSQLt is compatible with all SQL Server editions from SQL Server 2005 Service Pack 2 onward.checked 5 Oct 2026
- Support and community
- The quick start points users to the tSQLt mailing list, GitHub, Stack Overflow, and the SQL Server Community Slack #tsqlt channel.checked 5 Oct 2026
- Support and learning
- The quick start links to a mailing list, GitHub, Stack Overflow, and the SQL Server Community Slack #tsqlt channel.checked 4 Oct 2026
- Test language
- It lets developers implement unit tests in T-SQL.checked 4 Oct 2026
- Test organization
- Tests can be grouped within schemas so teams can organize them and use common setup methods.checked 5 Oct 2026
- Test output
- tSQLt can generate plain text or XML output to support integration with continuous integration tools.checked 5 Oct 2026
- Training
- The site lists sqlity.net and dlmconsultants.com as vendors offering hands-on tSQLt and TDD training.checked 5 Oct 2026
- Transaction isolation
- Tests run automatically within transactions to keep tests independent and reduce cleanup work.checked 5 Oct 2026
Alternatives to tSQLt
- 1

Atlas
Free planOpen sourceWebAPILinuxmacOS8.3From $39 a month - 2

DataKitchen TestGen
Free planOpen sourceWebAPILinuxmacOS8.1From $100 a month - 3

Soda
Free planWebAPILinuxSelf-hosted7.5From $750 a month - 4
Avidemux
Free planOpen sourceWebLinuxmacOSWindows7.3Free plan - 5
pgroll
Free planOpen sourceLinuxmacOSSelf-hostedWindows7.3Free plan - 6

Bytebase Enterprise
Free planWebAPISelf-hosted6.8From $20 a month
