• Any interest in an article on using CodeSmith to generate tsqlt tests and avoid the need to write boiler plate code.

    When testing stored procedures that return from one to N results sets. Or inline table valued functions that return a table. These types of tests will, typically, contain a fair amount of boiler plate. Fake some tables, insert some test data, execute the stored procedure, check the number of rows returned and in some cases the values or the range of those rows.

    A couple other examples,

    When writing tests for the CRUD style stored procedures, was an insert done, was an update done, does the table contain the updated values.

    Tests that check the individual table schemas have not changed. Are the columns originally marked as not null still marked as not null today. Is a column that was created as nchar(60) still nchar(60) or did some one change the size of the column?

    Anyway, I use CodeSmith to generate the boiler plate in these types of tests. Yes, I know that goes against the concepts of TDD, it does reduce the grunt work. I would show some snippets of the actual templates used but not go into a lot of detail on the template code.