I recently completed Dave Green’s Pluralsight course entitled Unit Testing T-SQL Code with tSQLt. I think the material was solid and Green does a good job presenting it, as well as Red Gate’s add-on tool called SQL Test.
I did learn a lot about tSQLt from this course. I had played with tSQLt a little bit a few years back, and it looks like the product has matured since then. One of the big reasons I was interested in checking out this course is to see how tSQLt handles isolating dependencies, and Green has an entire section on the topic.
My main problem with the course has nothing to do with Green or the way he presented the topic; rather, I think it’s a flaw in the product itself. It seems like a lot of the tests that Green walked through did more testing of tSQLt than actual business or procedure logic. For example, to test a check constraint, the tests weren’t really checking the constraint, but rather a mocked constraint. This seems like an artificial attempt to force unit testing in a place where integration testing is appropriate. Again, I don’t blame Green for this; rather, I think it’s a disagreement I have with the product itself.