[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: In-PostgreSQL tests



On Sun, Sep 28, 2008 at 9:19 AM, Jeff Kowalczyk <..hidden..> wrote:
> Should LedgerSMB start using a testing framework/style which interacts
> directly with/in PostgreSQL?
>
> It would seem to be useful now for the legacy codebase, and essential
> going forward with the stated direction of increasing stored-procedure
> logic.

I think it would be of limited utility in the legacy codebase because
typically there our problems would be separable from the tests, and
the tables are not changing sufficiently to make db-regression testing
particularly productive.

However, going forward we *do* need an in-db testing framework.
Currently I have put together something (at least temporarily) for
testing the functions in Session.pm (in trunk, see
sql/modules/test/Session.sql).

The two major criteria I see here are:

1)  The ability to run all tests in a transaction that rolls back (so
they can be run for support purposes on a live db)
2)  The ability to unit test stored procedures.

In some cases criteria one may limit some aspects of the testing but
if the need arises, I suppose we could create test-only scripts....

>
> Two projects that looked interesting:
>
> http://pgfoundry.org/projects/pgtap/
> TAP-based unit tests for your database. pgTAP is a suite of database
> functions that make it easy to write unit tests in psql scripts suitable
> for harvesting, analysis, and reporting by a TAP harness, such as those
> used in Perl and PHP applications.

I would like to see a little more of a track record before moving to a
very new framework like this.

I like the general idea, though.

>
> http://epictest.org/
> Epic is a unittest framework for PostgreSQL stored procedures. Epic
> provides PL/pgSQL library functions to help write, run, and manage tests.

This looks like it would meet the general needs pretty well.  Maybe
once it stabilizes a bit :-)

Best Wishes,
Chris Travers