I presented a session today at Redgate Streamed and did a number of demos. The code consists of a few flies, which I’ve made available here: BasicUnitTesttsqlt.zip.
This consists of:
- 00_tsqlt.sql – Creates a database and adds the tsqlt framework.
- 01_GetTesting_tsqlt_Setup.sql – adds objects you need.
- 10_SQT_SQLCop_Demo.sql – The standards test demo
- 20_SQT_RefactorArticles_MetaData.sql – Testing a table API
- 30_SQT_RefactorArticles_IsolateProcedure – Test a function and procedure separately
- 40_SQT_RefactorArticles_Exceptions.sql – Testing edge cases and bad data
- 50_SQT_RefactorGrouping.sql – Sample test class breakdown
- 99_SQT_Cleanup.sql – cleans things up
You do need to have the SQLCLR enabled, and you will enable TRUSTWORTHY for this test database.
Any question, let me know.