Unit Test Your Database!

Use a flexible database unit testing framework to assure database integrity and functionality

Given that the database, as the canonical repository of data, is the most important part of many applications, why is it that we don't write database unit tests? This talk promotes the practice of implementing tests to directly test the schema, storage, and functionality of databases.

We're all used to unit testing our applications by now. The Extreme and Agile programming movements have done a great deal to promote unit testing, to the extent that many of us are now dependent on tests to assure that our applications work reliably. But how often do we test the database underlying our applications? Given that the database, as the repository for all of the knowledge and data for an application, just might be the single most important part of that application, the time for standardized database unit testing has come.

This talk promotes the practice of writing and running unit tests that directly test the schema, storage, and functionality of application databases. Following a review of the available PostgreSQL unit testing frameworks, we'll review examples of testing tables, views, columns, constraints, indexes, triggers, and functions. The idea is to promote complete test coverage every aspect of a database, independent of application unit tests, to ensure reliably canonical data integrity.