Unit Test Your Database!

Databases, Programming
Location: Meeting Room J1/J4
Average rating: ****.
(4.29, 14 ratings)

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, and that in a busy development environment one developer can change the database in ways unexpected by other developers, 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 of every aspect of a database, independent of application unit tests, to ensure reliably canonical data integrity.

Photo of David Wheeler

David Wheeler


David E. Wheeler is President of Portland-based Kineticode, and former CTO of Values of n, creators of the PostgreSQL-and-Rails-powered iwantsandy.com, home of Sandy, your personal email assistant. David is also maintainer and lead developer of Bricolage, a content management and publishing system powered by Perl and PostgreSQL. For his next trick, he may or may not build a Python or Lisp or BASIC-powered Web application, but whatever it is, it will likely be built on PostgreSQL. Unless it’s a blog, in which case he’ll just use SQLite.

Comments on this page are now closed.


Picture of Bill Karwin
Bill Karwin
07/29/2009 1:18am PDT

I guess I’m old-fashioned. So take my earlier feedback with a grain of salt as it suits you.

I do agree the topic was important, and your demonstrations were engaging examples of the “show, don’t tell” principle.

Henning Michael Møller Just
07/24/2009 7:18am PDT

Apparently disagreeing with a previous commenter, I found your talk very engaging.

Apart from being interesting I also learned a lot – for those who didn’t attend I’d like to add one lesson that I believe really is the key here: Where there’s code, you should unit test.

Picture of Bill Karwin
Bill Karwin
07/23/2009 3:06pm PDT

You tried too hard to use an irreverent style, and pushed over the line into being unprofessional. You have good content—don’t be such a clown that you spoil your credibility.

Picture of Robert Hoelz
Robert Hoelz
07/23/2009 9:49am PDT

Entertaining and informative, and he referenced Perl’s Test::Tutorial. ‘Nuf said.

  • Intel
  • Microsoft
  • Google
  • SourceForge.net
  • Sun Microsystems
  • Facebook
  • Gear6
  • Kaltura
  • Liferay
  • MindTouch
  • MySpace.com
  • Novell, Inc.
  • Open Invention Network
  • Rackspace Cloud
  • Schooner Information Technology
  • Silicon Mechanics
  • Symbian Foundation
  • Twilio
  • WSO2
  • Yabarana Corporation

Sponsorship Opportunities

For information on exhibition and sponsorship opportunities at the conference, contact Sharon Cordesse at scordesse@oreilly.com

Download the OSCON Sponsor/Exhibitor Prospectus

Media Partner Opportunities

Download the Media & Promotional Partner Brochure (PDF) for information on trade opportunities with O'Reilly conferences or contact mediapartners@ oreilly.com

Press and Media

For media-related inquiries, contact Maureen Jennings at maureen@oreilly.com

OSCON Newsletter

To stay abreast of conference news and to receive email notification when registration opens, please sign up for the OSCON newsletter (login required)

Contact Us

View a complete list of OSCON contacts