In this blog post, Jens Schauder shares some tips based on experience to improve the testing of database code. People seem to understand the need to test their code, but apparently this is not yet the case for the the database code, because database tests tend to be slow, interdependent and hard to maintain
Here are some of the tips suggested by Jens:
* Give every developer her own database.
* Favor a proper language (like Java) over database specific languages like T-SQL or PL/SQL
* Have a small layer that does all interaction with the database.
* Favor database independent SQL or a library abstracting away the differences of various databases.
* Consider an in-memory-database for testing.
* Make sure your tests clean up after them selves.
You will find the rationale for these tips and more suggestions on his blog.