SQL Clone
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in

Download tSQLt Today and Start Unit Testing

By Press Release,

The latest version of the tSQLt unit testing framework is now available for download. This is a framework designed to help you write unit tests in T-SQL as stored procedures and execute them programmatically to ensure your code runs as expected.

Learning tSQLt

We've got a number of articles at SQLServerCentral to help you, and there are also tutorials and a quick start on the tSQLt site.

However the best way to get started with unit testing is to try and write some tests. I encourage people to write tests when they find issues, not for every line of code you write. Create a test when you have a bug reported.

Use the very simple format of AAA, which means:

  • Assemble - setup your environment
  • Act - call your code
  • Assert - test the results with one of the assertions in tSQLt.

It's not hard, and once you get the hang of it, you'll find that unit tests are quick and easy ways to ensure that bugs that are reported don't reappear.


There are a few addons that make tSQLt more powerful.

Download Today

Writing tests can help improve the quality of your code. Download tSQLt today at tsqlt.org/downloads.

Total article views: 1707 | Views in the last 30 days: 1
Related Articles

Updating tsqlt

I was looking to write a new test with the tsqlt framework recently. I wanted to isolate a stored pr...


Installing tSQLt

Get started testing your database code with the tSQLt framework.


tSQLt Course

In the last half of 2017, I decided to run a tSQLt course and went down the route of putting...


Generating tSQLt tests from a dacpac

Generating tSQLt tests from a dacpac I use SSDT and tSQLt in my work and I am always interested i...


Using tSQLt to Find Min/Max Times

I love tSQLt. It’s a good way to write tests that can determine if your code is actually working. Si...