UnitAutogen is a single executable, unitautogen. You point it at a PostgreSQL database and it reads your functions and triggers, writes the tests, runs them and reports coverage, with no test written by hand. The tests it produces are standard pgTAP, so they run with SELECT runtests(...) or pg_prove like tests you would write yourself.
It works with any PostgreSQL 14 to 18, self-hosted or managed. That includes Supabase, Neon, Amazon RDS and Aurora, and Azure Database for PostgreSQL, wherever you can enable the pgTAP and plpgsql_check extensions. These pages apply to version 0.5.0-beta.
Each command has its own page with what it does, its command line, the report it writes and where its files go. Every command shares the same basic options and prints one line per routine plus a summary.
| Command | What it does | Edition |
|---|---|---|
unit testsunitautogen --schema public | Unit tests and branch and statement coverage for your functions and triggers. No command word needed. | Community |
integrationunitautogen integration --schema public | Every routine run for real, together with the functions it calls and the triggers its writes fire. | Team |
seccoverunitautogen seccover --schema public | The full security review of functions, views, triggers, RLS policies and column-level security. | Enterprise |
piiunitautogen pii --schema public | Personal data leaked through error and RAISE messages. On by default inside seccover. | Enterprise |
hipaaunitautogen hipaa --schema public | Runs seccover, adds the audit-log check and writes a stamped HIPAA report. | Enterprise |
Inside a Supabase project, add --supabase to any of them. See Supabase mode. To add or correct the PHI, personal-data and audit tables the tool detects, keep a unitautogen.toml next to your code. See The config file.
UnitAutogen never gives you a fabricated, false-passing or flaky test. Every generated test is re-run on a clean pass before it is kept. A branch that cannot be driven soundly is reported as NOT_TESTABLE with a plain reason, never faked. So every report shows 0 failed and 0 false tests.
char and varchar, uuid, domains with CHECK, arrays, bit(n), bytea, money, ltree, hstore, inet and cidr, ranges, composite types, generated columns and quoted mixed-case names.OUT and INOUT parameters, chains of local variables, date differences, NOT IN with a NULL, and divide by zero.DELETE, NOT NULL, UNIQUE on the real key, and bad xml, json or base64 input. A handler test is named for the handler that really ran, or marked not reached.CHECK (col IS NOT NULL), unique indexes without a primary key, generated columns and the column types above.DATABASE_URL is read as a connection string, and an unreachable database gives a clear CANNOT CONNECT message and exit code 4. See Connecting.