Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 

Is Unit Testing Important?

By Steve Jones,

This editorial was originally published on Nov 10, 2009. It is being re-run as Steve is on vacation.

I saw a question on the SQLServerCentral ASK site the other day asking about unit testing for T-SQL stored procedures. There weren't many responses, but they were interesting to me.

I wondered how many people bothered to test their stored procedures as a unit. It seems that the idea of test driven development, or even of comprehensive testing of SQL code isn't very mature. If a query runs and appears to return the data we want, do we bother to test for edge or unusual data conditions?

Or do we even know how to write those kinds of tests?

Testing your code as it's being written is a well known way to reduce your technical debt and ensure better code when it's released. It's also a way to lower the cost of maintaining your software over its lifetime. However it slows down development as well.

That' s not why most people don't test their code well. The big reason is that it's B-O-R-I-N-G.

But does it matter? Is there really an issue? After all most T-SQL queries are built to scale. If the data is correctly assembled into sets with a small set of data, it will work correctly on large sets of data. Maybe not efficiently, but it tends to work. So is unit testing of T-SQL code important?

My guess is that it is not all that important. At least not as important as performance tuning. If you have extra time to spend on a query, I think most DBAs would prefer to spend it on making the SQL more efficient, not more tested.

Steve Jones


The Voice of the DBA Podcasts

The podcast feeds are available at sqlservercentral.mevio.com. Comments are definitely appreciated and wanted, and you can get feeds from there.

You can also follow Steve Jones on Twitter

Overall RSS Feed: or now on iTunes!

Today's podcast features music by Everyday Jones. No relation, but I stumbled on to them and really like the music. Support this great duo at www.everydayjones.com.

I really appreciate and value feedback on the podcasts. Let us know what you like, don't like, or even send in ideas for the show. If you'd like to comment, post something here. The boss will be sure to read it.

Total article views: 356 | Views in the last 30 days: 2
 
Related Articles
BLOG

Podcasting

A new video setup is on the way!!!! Actually I'll do a couple podcasts on podcasting over the hol...

ARTICLE

Podcast Announcements

Podcast Feeds

FORUM

Podcast Problem

Podcast Problem Blocked by group policy

ARTICLE

Is Steve Jones Really Steve Jones?

Alien imposter? No, not that complicated. Andy saw an actor on TV that according to some looks JUST ...

BLOG

Steve Jones Finally Reads My Blog!

I've been following Steve's exploits trying to learn the podcasting business and we usually talk a...

Tags
editorial    
testing    
unit testing    
 
Contribute

Join the most active online SQL Server Community

SQL knowledge, delivered daily, free:

Email address:  

You make SSC a better place

As a member of SQLServerCentral, you get free access to loads of fresh content: thousands of articles and SQL scripts, a library of free eBooks, a weekly database news roundup, a great Q & A platform… And it’s our huge, buzzing community of SQL Server Professionals that makes it such a success.

Join us!

Steve Jones
Editor, SQLServerCentral.com

Already a member? Jump in:

Email address:   Password:   Remember me: Forgotten your password?
Steve Jones