Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Writing a unit testing framework for testing SQL stored procedures

Today I had an idea of writing a unit testing framework for stored procedures in MySQL. The full idea is written on a recent post on my blog. In short it goes like this: I want to automate my procedure testing, I want to use a standardized way to test my procedures. Unit testing is widely documented, and there are a zillion XUnit frameworks out there, why not write one for MySQL (or any other database). It would be open source of course. What do you think? It is silly, stupid, needless or what? Or another idea would be to write a general database framework in SQL. Hmm, I really want to discuss that with someone, collect thoughts and ideas.

like image 761
Nikola Stjelja Avatar asked Oct 29 '08 22:10

Nikola Stjelja


3 Answers

There's already one testing framework for Sql Server - TSQLUnit. Maybe you can get some useful info from it.

like image 60
Rockcoder Avatar answered Nov 10 '22 10:11

Rockcoder


Yes, great idea. I've been having a fair bit of success with pgTAP. I've used it in a number of projects, both for test driven database development and to write tests for existing procedures in order to be able to effectively refactor them.

I have often been asked if there's something like it for MySQL. Maybe you've written something by now?

like image 1
theory Avatar answered Nov 10 '22 10:11

theory


There are already unit tests out there. Apart from dbUnit and sqlUnit, try:

MyTAP: https://github.com/hepabolu/mytap
datacharmer.org: http://datacharmer.blogspot.com/2006/01/mysql-5-general-purpose-routine_27.html

like image 1
David Soussan Avatar answered Nov 10 '22 09:11

David Soussan