CodeBetter.Com
CodeBetter.Com
RSS 2.0 via Feedburner
           Do you Twitter? Follow us @CodeBetter

Brendan Tompkins [MVP]

Blog First. Ask Questions Later.

Auto Generate NUnit Tests for Your SQL Sprocs!

Now that I'm on our “SQL Team” (kinda scary isn't it) I'm trying to implement some semblance of unit testing and source control for our SQL stored procedures.  I just downloaded a copy of ApexSQL Edit and have been playing around with it.  I right clicked on a stored procedure, and there was this beautiful little menu choice:

So I click on it, and low and behold, it generated good ol' NUnit test harness code!  You can even add conditionals and manage your tests through the UI.  Very cool indeed. 

Update.  Very buggy indeed, not sure I can recommend the current version for purchase but still cool.

-Brendan



Comments

Brendan Tompkins said:

This is a good question. Do you need tests for your data tier. I think tests for procs are good idea, because other teams can run them as they make changes to sql. But, if you're testing your business tier, do you even want to have separate testing for your dal? Do you care?
# November 23, 2004 3:54 AM

William D. Bartholomew said:

There is something called TSqlUnit floating around (I believe MSDN recently published an article about it in the magazine). Worth a look if you want to just test the stored procedures and not ADO .NET/DAL as well.
# November 23, 2004 1:45 PM

s said:

s
# June 15, 2006 6:52 AM

Leave a Comment

(required)  
(optional)
(required)  

Enter the numbers above:
Add

About Brendan Tompkins

Brendan has been programming with .NET since the first public beta and is owner and operator of Port Technology Services, a consultancy company providing .NET application development services to the Maritime industry. In July, 2007, he was awarded the Microsoft MVP award for ASP.NET. He's also a proud co-founder of failed .COM startup Intrinsigo, and has had a hand in the failure of numerous other businesses. He currently runs CodeBetter.Com and Devlicio.us, and lives in Norfolk, Virgina with his wife Tiara and son Ian.

View Brendan's profile on LinkedIn

Check out Devlicio.us!

Our Sponsors

Free Tech Publications