tSQLt 101
In the previous post on unit testing, I tried to demonstrate how a bug can be created in a pretty innocuous fashion. Unit testing is common in most development platforms, but as always, SQL has to be different. SQL has state – mostly because of the data within the database. If you have some C# code, and you want to completely re-write it, go ahead. As long as the inputs, outputs, and other behaviors are the same, you should be fine. Not so with SQL, which makes unit testing a little trickier.
There are several unit testing frameworks out there. The one I have been using is tSQLt. Although it is powerful, the documentation left me lost. In a series of articles, I would like to demonstrate how to set up tSQLt, and how to set up a basic test. I will then go into some more details about building a test framework of many tests, and ways to automate the testing, hopefully elaborating on the documentation as I go along.Read More »tSQLt 101