I’m having a lot of fun writing common_schema, an SQL project which includes views, tables and stored routines.
As the project grows (and it’s taking some interesting directions, in my opinion) more dependencies are being introduced, and a change to one routine or view may affect many others. This is why I’ve turned the development on common_schema to be test driven.
Now, just how do you test drive an SQL project?
Well, much like the way you test any other project in your favorite programming language. If its functions you’re testing, that’s all too familiar: functions get some input and provide some output. Hmmm, they might be changing SQL data during that time. With procedures it’s slightly more complex, since they do not directly return output but result sets.
Here’s the testing scheme I use: Continue reading » “Test-driven SQL development”