Freedom251 › Database Testing Tools
tSQLt

What tSQLt is
tSQLt is an open-source unit testing framework for Microsoft SQL Server that lets developers write tests in T-SQL. Tests run within transactions to help keep them independent and reduce cleanup work. Developers can group tests in schemas, which can also hold common setup methods. To isolate code under test, tSQLt can fake tables and views and create stored procedure spies. The user guide includes assertions such as AssertEquals and AssertEqualsTable. Test output can be generated as plain text or XML for continuous integration tools. The framework is self-hosted, and its listed plan costs nothing; the repository identifies its license as Apache 2.0. The project says it works with all SQL Server editions from SQL Server 2005 Service Pack 2 onward. Installation requires running PrepareServer.sql once per server with SA permission, then installing tSQLt in a development database. The quick start says tSQLt should never be installed in production.
Who it suits
tSQLt suits SQL Server database developers who want to write unit tests in T-SQL and organize them into schemas. It may also suit teams integrating test output into continuous integration tools.
What it does well
- Writes unit tests in T-SQL.
- Runs tests within transactions.
- Can fake tables and views.
- Generates plain-text or XML output.
- Works with listed SQL Server editions from 2005 SP2 onward.
What to know first
- Requires SA permission to run PrepareServer.sql.
- Should never be installed in production.
- Self-hosted installation is required.
Limits
The free tSQLt framework is intended for development databases; the quick start says it should never be installed in production.
Plans
| Plan | Billed and limits | Price |
|---|---|---|
| tSQLt | Open source database unit testing framework for SQL Server | Free |
As tsqlt.org lists them, read 5 Oct 2026. The maker's own page has the final word.
Getting started
- Open https://tsqlt.org/ and follow the quick start.
- Run PrepareServer.sql once per server with SA permission.
- Install tSQLt into a development database.
- Use schemas to organize tests and shared setup methods.
- Optionally use Redgate SQL Test for a graphical SSMS interface.
Verdict
tSQLt provides transaction-based testing and isolation features for SQL Server development. Its installation requires server-level permission, and the project says to keep it out of production.
Questions
How much does tSQLt cost?
The listed tSQLt plan is free. It is open source.
Which database does tSQLt support?
It is for Microsoft SQL Server. The project says it works with all SQL Server editions from SQL Server 2005 Service Pack 2 onward.
Where does tSQLt run?
It is self-hosted. Setup installs it in a development database after a one-time per-server script step.
What license does tSQLt use?
The official repository identifies the license as Apache 2.0.
Can tSQLt connect to continuous integration tools?
It can generate plain text or XML test output for integration with continuous integration tools.
Is there a graphical interface for running tests?
The downloads page names Redgate SQL Test as its preferred SSMS plug-in for running tSQLt tests through a graphical interface.
Facts from tSQLt's own pages
- Assertions
- The user guide includes assertions such as AssertEquals and AssertEqualsTable. · tsqlt.org, 5 Oct 2026
- Audience
- The site describes tSQLt as a way to bring unit testing and test-driven development to SQL Server database development. · tsqlt.org, 4 Oct 2026
- CI output
- Test output can be generated as plain text or XML for integration with continuous integration tools. · tsqlt.org, 4 Oct 2026
- Dependency isolation
- The framework can fake tables and views and create stored procedure spies to isolate tested code. · tsqlt.org, 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. · tsqlt.org, 5 Oct 2026
- Installation
- Installation uses the included tSQLt.class.sql script in a development database. · tsqlt.org, 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. · tsqlt.org, 4 Oct 2026
- Integrations
- The site identifies Redgate SQL Test as its preferred commercial SSMS extension and the official SSMS plug-in for tSQLt. · tsqlt.org, 5 Oct 2026
- Isolation
- The framework can fake tables and views and create stored procedure spies to isolate code under test. · tsqlt.org, 4 Oct 2026
- License
- The official repository identifies the license as Apache 2.0. · github.com, 4 Oct 2026
- Organization
- Tests can be grouped in schemas, which also allow common setup methods. · tsqlt.org, 4 Oct 2026
- Production limit
- The quick start says tSQLt should never be installed in production. · tsqlt.org, 4 Oct 2026
- Production limitation
- The quick start says tSQLt should never be installed in production. · tsqlt.org, 5 Oct 2026
- Purpose
- tSQLt is an open source framework for unit testing SQL Server databases with tests written in T-SQL. · tsqlt.org, 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. · tsqlt.org, 5 Oct 2026
- SQL Prompt support
- The site offers a set of snippets for Redgate SQL Prompt to make working with tSQLt easier. · tsqlt.org, 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. · tsqlt.org, 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. · tsqlt.org, 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. · tsqlt.org, 4 Oct 2026
- Test language
- It lets developers implement unit tests in T-SQL. · tsqlt.org, 4 Oct 2026
- Test organization
- Tests can be grouped within schemas so teams can organize them and use common setup methods. · tsqlt.org, 5 Oct 2026
- Test output
- tSQLt can generate plain text or XML output to support integration with continuous integration tools. · tsqlt.org, 5 Oct 2026
- Training
- The site lists sqlity.net and dlmconsultants.com as vendors offering hands-on tSQLt and TDD training. · tsqlt.org, 5 Oct 2026
- Transaction isolation
- Tests run automatically within transactions to keep tests independent and reduce cleanup work. · tsqlt.org, 5 Oct 2026
Where tSQLt stands on Freedom251
- Database Testing Tools#23 of 28
