Click here to monitor SSC
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in
Home       Members    Calendar    Who's On

Add to briefcase ««12

Test-Driven Development of T-SQL Code Expand / Collapse
Posted Tuesday, October 28, 2008 8:30 AM


Group: General Forum Members
Last Login: Monday, July 25, 2016 10:16 AM
Points: 482, Visits: 1,482
Grant Fritchey (10/28/2008)

While I do agree, we use Visual Studio Team System Database Edition for unit testing now, a few of your negatives probably shouldn't be on the list. #4 especially. You shouldn't be running unit tests against production machines, ever. Unit testing is a development only process that should be isolated from other systems, especially a production system.

I guess I wasn't clear about what I meant for #4.
We wanted to use TSQLUnit for data validation as well as unit testing.
For example: let's say we run some data export for a client.
We are creating a file (xml, csv, flat file) to send to them.
After we create the file, we load it into the database.
We then want to run SQL scripts against the file comparing the file to the original data in order to validate the file.
We would have to do this in our Production environment.

Also, when we were using TSQLUnit, we only ever created a test database by deploying code there first. You can keep it seperate from your development, integration & QA databases. It's an extra step in development though.

That sounds like it would take a lot of extra time, and when does development ever have extra time?!?
Post #592939
Posted Wednesday, July 7, 2010 2:54 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Wednesday, July 7, 2010 2:46 PM
Points: 1, Visits: 0
Those who are failing to see the value of this may perhaps be failing to see the value of TDD in any context. To quote Robert Martin: "Now most programmers, when they first hear about this technique, think: "This is stupid!" "It's going to slow me down, it's a waste of time and effort, It will keep me from thinking, it will keep me from designing, it will just break my flow." However, think about what would happen if you walked in a room full of people working this way. Pick any random person at any random time. A minute ago, all their code worked."

The point here is *not* to see the big picture. The big picture is painfully obvious: our code is fragile and tightly coupled. And we have no way of being confident that the next developer who touches it won't break it. Quality begins with the first line of code.

This technique is more profound than perhaps you're seeing.
Post #948854
« Prev Topic | Next Topic »

Add to briefcase ««12

Permissions Expand / Collapse