At a glance
| Supported databases | SQL Server 2005 SP2 and later, including SQL Server on Linux |
| Data generation | None; tests insert the rows they need into faked tables |
| Masking | Not applicable |
| Referential integrity | FakeTable removes constraints so tests can insert minimal rows |
| CI/CD integration | XML test results for CI servers; GitHub Actions and Azure DevOps used by the project |
| Test automation | Unit tests for procedures, functions and views in T-SQL |
| Data volume or subsetting | Not applicable |
| Deployment | Installed into a development database; requires CLR and a one-time server preparation |
| Licensing | Free, Apache 2.0; Redgate SQL Test is a paid GUI on top |
| Azure SQL | Older 1.0.5873 build for Azure SQL Database per the downloads page; Managed Instance not documented |
tSQLt is the standard free choice for unit testing stored procedures, functions and views inside SQL Server, and it is what Redgate SQL Test runs under the hood. Each test runs in a transaction and can fake tables so it does not depend on existing data. The current build needs a CLR assembly and a server preparation step, it should never be installed in production, and releases have been quiet since 2022.
Overview
tSQLt is a database unit testing framework implemented as T-SQL objects (plus a CLR assembly) that you install into a development database. Tests are stored procedures grouped into test classes, which are schemas; tSQLt runs each test inside a transaction and rolls it back, so tests stay independent without cleanup code. Test doubles such as FakeTable, FakeFunction and SpyProcedure isolate the code under test from real tables and dependent procedures.
The project documents compatibility with all SQL Server editions from 2005 SP2, and V1.0.7942 (September 2021) was certified for SQL Server on Linux and added DACPAC installation. The quick start says PrepareServer.sql, run once per server with sysadmin rights, enables CLR and installs a certificate so strict CLR security does not need to be disabled. The downloads page offers the older 1.0.5873.27393 build as the one that works with SQL Server 2005 and Azure SQL Database; support for Azure SQL Managed Instance is not documented.
Key features
- Tests written as T-SQL stored procedures, grouped into schema-based test classes with shared setup
- Automatic transaction per test with rollback, so tests do not leave data behind
- FakeTable and FakeFunction to replace real tables and functions with empty or controlled versions
- SpyProcedure to record calls to dependent procedures, with an optional @CallOriginal parameter (V1.0.8043)
- AssertEqualsTable and other assertions for comparing result sets and values
- Plain text or XML output for continuous integration servers
- Installation by script or by SQL Server version-specific DACPACs
Integrations and ecosystem
Pros and cons
Pros
- Free and open source under Apache 2.0
- Tests live in the database and are written in T-SQL, the language under test
- Test doubles make it practical to test one procedure in isolation
- Sponsored by Redgate, with a commercial SSMS front end (Redgate SQL Test) if you want one
Cons
- No release since February 2022
- Needs CLR and a sysadmin-run PrepareServer step; must not be installed in production
- Current build is not documented for Azure SQL Database or Managed Instance
- SQL Server only
Pricing
tSQLt is free and open source under the Apache License 2.0. Redgate sells SQL Test, an SSMS add-in built on tSQLt, at $303 per user per year (1-4 users) or inside SQL Toolbelt Essentials, but tSQLt itself needs no licence.
Pricing checked on the vendor's official page on 7 November 2026. Prices change; confirm before buying.
Who it is best for
SQL Server teams that keep business logic in stored procedures and want automated, isolated unit tests for that code in development and CI.
Typical use cases
- Unit testing a pricing or billing stored procedure against faked input tables
- Checking that a procedure calls an audit procedure, using SpyProcedure
- Running database tests on every pull request in a CI pipeline
- Guarding against regressions when refactoring legacy T-SQL
Who should look elsewhere
- PostgreSQL teams: pgTAP fills the same role there.
- Teams whose main target is Azure SQL Database with the current build, where the documented support is limited to an older release.
Verdict
tSQLt remains the practical default for unit testing T-SQL code, free and backed by a Redgate commercial front end. Weigh the CLR and server preparation requirements, the lack of releases since 2022 and the limited documented Azure SQL support before standardising on it for cloud-hosted databases.
Frequently asked questions
Is tSQLt free?
Yes. tSQLt is open source under the Apache License 2.0. Redgate SQL Test, which adds an SSMS interface on top of tSQLt, is a paid product.
Does tSQLt work on Azure SQL Database?
The tSQLt downloads page offers the older 1.0.5873.27393 build as the version that works with Azure SQL Database. The current build installs a CLR assembly and a server certificate, and its notes do not document Azure SQL Database or Managed Instance support.
What is the latest tSQLt version?
V1.0.8083.3529, released on 17 February 2022, is the most recent release in the tsqlt.org release notes as of 7 November 2026.
Can tSQLt run on SQL Server on Linux?
Yes. Release V1.0.7942.19440 (September 2021) states that tSQLt is certified for SQL Server on Linux.
Sources
- tSQLt home
- tSQLt quick start (installation)
- tSQLt downloads
- tSQLt release notes
- tSQLt GitHub repository (Apache 2.0)
- Redgate SQL Test (built on tSQLt)
Checked November 2026.
Listed in: Database Testing & Test Data.
How we research reviews and what star ratings mean: our editorial method.