Available for PostgreSQL, free in the Community Edition
Unit tests for your database logic, without writing them.
For developers who own functions, procedures and triggers nobody has unit-tested.
- One test per branch, true and false side
- Boundary values around every numeric gate
- Seed data created per test, including FK parents
- Line and branch coverage, uncovered lines explained
How to do it
Free in the Community Edition. Three steps.
- Install pgTAP and plpgsql_check in the target database, and download the binary.
- Point it at a throwaway copy by setting
UNITAUTOGEN_DSN or the standard PG* variables.
- Generate, run and measure. Unit testing is the default command:
unitautogen --schema public --out unit_tests --html report.html --json report.json
- One
test_<routine>.sql per function, triggers under trigger_tests/
- Commit them; re-run in CI with
pg_prove or runtests()
What each test asserts
Return value
Scalar results and result sets, compared to the recorded output.
Rows written
What the branch inserted, updated or deleted, so a broken branch fails.
Errors raised
The exact error an exception path produces.
How it fits your day
- Run it against a throwaway copy of the database
- Tests land as ordinary pgTAP files you can read, edit and commit
- Re-run after a change; the diff shows which behaviour moved
- In CI, a behaviour change fails the build before production
- What cannot be tested reliably is reported per line
- Never a fabricated, false-passing or flaky test
What platforms suggest
The tools PostgreSQL and Supabase point you to for testing database logic.