SQL Server Database Developers


Unit Testing Database Logic for SQL Server Database Developers

I haven't tried it, but Karl Gram seems to be cooking up something interesting - dbUnit for unit testing database logic.

dbUnit aids the developer in creating unit tests for all your database logic. You can test the table structure, inserts, updates, deletes, triggers and also procedures. In general the tool allows you as a developer to write all your unit tests in T-SQL and use NUnit to unit test them.

Some of the features of the current alpa version (0.5) are:

  • Create a dbUnit project
  • Add unit tests to the project
  • Specifiy the SQL Server to connect to
  • Handle expected exceptions (e.g raiserror and other database errors)
  • Generate the NUnit test dll
  • Start NUnit from within dbUnit