Working on a database application, the urge for testing of database has appeared. Unfortunaltely, there are no real framework that can tackle this problem (real means with specialized assertion and fixtures). Unit test framework like NUnit are too simplistic to provide such functionality.
A little hope: I have run into this nice article which gives an introduction about database testing. The author gives a good methodology to set up a test framework for database:
- Separate production database from test database
- The test fixture must empty the tables of the test db befure launching the runs
- do small unit tests using the business objects.
There is one big gotcha about this: usually database are run in an "heavy" multithreaded environment and, in testing, we would like to detect locks and so on. The Unit test approach is too gentle :). I'll come back on this problem later (with somes solutions hopefully).