RSS Feed Subscribe to RSS Feed

 

OSCON Day1: Test Driven Database Development

The first tutorial at OSCON was on Test Driven Database Development. The idea was to use pgTAP to write unit tests to check database correctness, including table structures, views and stored procedures. As a fan of Test Driven Development (TDD) for regular code, the concept of using it on the database tier makes a lot of sense.

Unfortunately I had a lot of problems getting the required software setup working, which included PostgreSQL, pgTAP, Test::Harness, make and perl. Ultimately I wasn’t able to get the examples running due to imcompatabilities between PostgreSQL and pgTAP on my Macbook Pro (OS X 10.5.8) and ended with this error:


dyld: Library not loaded: /usr/local/lib/libxml2.2.dylib
Referenced from: /Library/PostgreSQL/8.4/lib/postgresql/pgxs/src/makefiles/../../src/test/regress/pg_regress
Reason: Incompatible library version: pg_regress requires version 10.0.0 or later, but libxml2.2.dylib provides version 9.0.0

I considered trying to upgrade libxml, but there were suggestions that this could cause my machine to not boot! I even considered upgrading to OS X 10.6 (Snow Leopard), but decided that this was a little too close to shaving yaks.

I would really like to get more familiar with pgTAP at some point, but I will have to put on hold for now…

Update: I managed to get some input from David Wheeler, worked through the technical issues and got all the tests running. Thanks David! Despite the earlier setup problems, I came away with a very positive feeling about TDDD and pgTAP and can see it playing a part in any future database schema development I do.

Tags: , , , ,