- Clone or download the repo
- Create a new database.
- Install the database inside the /Sample Database/Sample Test Database.sql
- Download the latest tSQLt install scripts from tsqlt.org.
- Unzip the file.
- In SQL Management Studio, select the database that will be used for testing.
- Execute the following files against the database.
- SetClrEnabled.sql
- This will enable Clr for the selected database
- tSQLt.class.sql
- This will install all the tSQLt functions for testing
- SetClrEnabled.sql
The test scripts located in /Test Scripts folder demonstrate some of the test features in tSQLt. Please refer to the tSQLt User Guide for more details on the tSQLt test functions used in the examples.
- Open a test script in SQL Management Studio.
- Create the test class used by the test script. The test script name would look something like the following: ALTER procedure [FunctionTests].[test function fake return value] In this case, 'FunctionTest' is the test class so create it by executing the following:
- EXEC tSQLt.NewTestClass 'FunctionTest'
- Update the script to say 'CREATE' instead of 'ALTER'
- Execute the script to create the test procedure in the test database base.
- Execute the following command to execute the test script(s).
- EXEC tSQLt.RunAll