SQLServerCentral

Writing Test Cases for T-SQL Code


https://www.sqlservercentral.com/Forums/Topic1480188.aspx

By Steve Jones - SSC Editor - Thursday, August 1, 2013 8:55 AM

I'd love some articles that look at a piece of code you've written (query/batch/proc) and then what test cases or code you've put together to verify it works.
By dwain.c - Thursday, October 17, 2013 8:30 PM

Are you still looking for something on this?

I have an idea that works through the process of designing a SP to handle a parameterized query, based on the best practice suggested by Gail Shaw in her SQL in the Wild article on Catch All Queries.
By Steve Jones - SSC Editor - Friday, October 18, 2013 2:19 AM

Yep, I'd actually like a few of these.

If you can put something together that tests some of the various possibilities for code, whether this is a variety of parameters or separate testing sprocs, that would be good.
By dwain.c - Friday, October 18, 2013 12:43 PM

As I have a hot idea in my head I'll work on it this weekend.
By Steve Jones - SSC Editor - Sunday, October 20, 2013 2:39 AM

Thanks, I'll take a look next week
By Steve Jones - SSC Editor - Friday, January 31, 2014 2:25 AM

Bump.

We are looking for more articles, but in a real situation where you've written a test for your code. We want examples people can learn from.
By Steve Jones - SSC Editor - Monday, June 1, 2015 5:26 AM

I would like some. I'd like to have an article that focuses on a particular test, why it's written, what it catches, or has caught.

Multiple articles is fine. Using any test framework.
By Steve Jones - SSC Editor - Tuesday, February 9, 2016 11:04 AM

bump
By jonathan.crawford - Monday, October 16, 2017 11:06 AM

Steve, you still looking? Trying to larn me sumthin', wondered if maybe I should document my crash and burn approach to TDD and CI along the way? Might be more entertainment than educational, but I'm sure the resulting commentary will help push me in new directions too.

By dwain.c - Saturday, October 19, 2013 6:13 PM

Article submitted!

Design, Build and Test a Dynamic Search Stored Procedure

It's a long one.
By dwain.c - Sunday, October 20, 2013 12:10 PM

I made a rather small but silly mis-statement which I have corrected and resubmitted.
By SQLEmil - Friday, May 29, 2015 8:59 AM

Are you still looking for articles in this vein? I've been overhauling a lot of my organization's unit test infrastructure and thinking about what makes for good and useful tests as I work through them. I've one example where I took a mostly useless unit test and overhauled it to provide greater value, and thanks to source control, I can probably replicate the steps easily enough.

I've also been stretching the limits of what I can do with unit tests and the SSIS Catalog...
By Steve Jones - SSC Editor - Tuesday, October 17, 2017 5:24 AM

Would love to see that. Always want new testing articles. Be nice to focus on an overall process with an example, but would appreciate other articles that show how to test case x or case y.