Alex Rivera | Logout

Is Unit Testing your SQL taking TDD Too far?

Asked 2009-04-08T15:18:30.187
26

There is an article out on www.sqlservercentral.com about unit testing your SQL.

The TDD Guy in me said good, we can test the database stuff.

The System Architect in me said, what logic are we testing? There shouldn't be any logic in the database, the only thing you should be doing in the data base is selecting, updating, or inserting.

So if you feel the need to unit test your SQL, are you just being really thorough, being overly pragmatic, or is it a sign of design smell?

Edit
Report

1 Answer

4

This issue is hottly debated. If you ask a DBA they will think its the best thing in the world to have all your apps use predefined stored procedures. Those days though are coming to an end, with Hibernate and LINQ gaining popularity, you really CAN use the database as a repository of information and have your data access layer process all requests. I think LINQ can do everything for you in MS SQL except full text searches. As for performance difference between SPROCs and LINQ, it is negligable. My vote is no code in the database, all code in yoru data access layer, and have testing for it.

answered 2009-04-08T15:25:54.770

Your Answer