Is it possible to implement Test Driven Development in SQL?
I am not a Db guy. I am just curious if there is a possibility to write asserts in Sql so that you can write unit tests for your scripts, for your sprocs etc. and then even implement a T开发者_Python百科est Driven Development approach to your sessions?
thanks!
You can do that actually, not directly from SQL throught, but the language you do your application.
Of cause you SQL must be incapsulated in DAL (Data Access Layer) and all data got by Repositories (or other data access classes). You can do unit testing of those classes, that would be running SQL scripts at the end. So, basically you will test your SQL code.
It is simplier to me, than trying to write such tests in SQL. :)
Sometime ago I had thought on that: http://www.beletsky.net/2010/11/testing-database-and-test-database.html
精彩评论