Quick Start


Okay! You read a little about tSQLt – you want to try it out! Now what? Here is the quickest way to get going:

Downloading tSQLt and Installing the Examples

1. Download tSQLt from SourceForge.
2. Unzip the file to a location on your hard drive.
3. Make sure CLRs are enabled on your development server by running the following sql:

EXEC sp_configure 'clr enabled', 1;

4. Execute the Example.sql file from the zip file to create an example database (tSQLt_Example) with tSQLt and test cases.
5. See below for installing tSQLt into your own development database.

Executing the Examples

1. Open a new Query Editor window.
2. Execute the following script to run all the example tests:


3. You will see the following output in the results window:

[AcceleratorTests].[test ready for experimentation if 2 particles] failed: Expected: <1> but was: <0>
|Test Execution Summary|
|No|Test Case Name                                                                                            |Result |
|1 |[AcceleratorTests].[test a particle is included only if it fits inside the boundaries of the rectangle]   |Success|
|2 |[AcceleratorTests].[test a particle within the rectangle is returned with an Id, Point Location and Value]|Success|
|3 |[AcceleratorTests].[test a particle within the rectangle is returned]                                     |Success|
|4 |[AcceleratorTests].[test email is not sent if we detected something other than higgs-boson]               |Success|
|5 |[AcceleratorTests].[test email is sent if we detected a higgs-boson]                                      |Success|
|6 |[AcceleratorTests].[test foreign key is not violated if Particle color is in Color table]                 |Success|
|7 |[AcceleratorTests].[test foreign key violated if Particle color is not in Color table]                    |Success|
|8 |[AcceleratorTests].[test no particles are in a rectangle when there are no particles in the table]        |Success|
|9 |[AcceleratorTests].[test status message includes the number of particles]                                 |Success|
|10|[AcceleratorTests].[test we are not ready for experimentation if there is only 1 particle]                |Success|
|11|[AcceleratorTests].[test ready for experimentation if 2 particles]                                        |Failure|
Msg 50000, Level 16, State 10, Line 1
Test Case Summary: 11 test case(s) executed, 10 succeeded, 1 failed, 0 errored.

4. Notice that one test is failing. Click here continue on to fix the failing test and add your own tests.
5. You may also wish to assign tSQLt.RunAll to a keyboard shortcut so you can run your tests easily.

Installing to Your Development Database

Now it is time to write unit tests against your own code. tSQLt should be installed into your development database.
1. Your database must be set to trustworthy for tSQLt to run. Execute the following script in your development database:


2. Execute the tSQLt.class.sql script (included in the zip file) in your development database.

Learning More

1. Check out the Tutorial on Unit Testing in SQL Server with tSQLt for quick examples on the core features.
2. Join the tSQLt Mailing List for discussion and questions
3. Discover more details on tSQLt’s features in the Reference section of the User Guide

 Posted by at 5:25 pm

hi, I tried to post the issue her but i am not able to. Please contact me through my e-mail. there are lot of errors. Erro occurs when executing the step 4.one among the errors is: Msg 15404, Level 16, State 19, Line 2 Could not obtain information about Windows NT group/user 'hhh\sss', error code 0x5.


hi i am facing issues in installation


Hi Suvin, David Green wrote about this exact same issue here: Ten Things I Wish I’d Known When I Started Using tSQLt and SQL Test Hope this helps! -Dennis