pgTAP
pgtap.org
- Free plan
- Linux
- Self-hosted
What pgTAP is
pgTAP is a free suite of database functions for writing PostgreSQL unit tests that emit TAP output. Tests can be written in psql scripts or xUnit-style functions. Assertions can inspect tables, columns, primary keys, function signatures, database values, views, procedures, functions, rules, and triggers. TAP output can be collected by a harness, and the project describes running tests with pg_prove. The xUnit-style runtests() function rolls back schema changes made during each test and supports setup, teardown, startup, and shutdown functions. Integration guidance covers Perl and PostgreSQL module workflows and mentions PHP and Python testing frameworks. pgTAP must be installed on a host where PostgreSQL is running; remote installation is not supported, and PostgreSQL 9.1 or newer is required. Its license permits use, copying, modification, and distribution under stated conditions. The license does not require the author to provide maintenance, support, updates, enhancements, or modifications. The listed stable release is 1.3.4, dated 2025-10-04.
Who it suits
pgTAP suits PostgreSQL teams writing SQL or PL-based schema, data, view, routine, rule, and trigger tests. It is intended for self-hosted database testing with TAP-compatible reporting.
Good to know, and what to watch
- Free PostgreSQL testing functions
- Checks schema objects and database behavior
- Supports psql and xUnit-style tests
- Rollback isolation for runtests()
- TAP output works with harnesses
- Must run on a PostgreSQL host
- Cannot be installed remotely
- Requires PostgreSQL 9.1 or higher
- No obligated maintenance or support
The verdict
pgTAP provides broad PostgreSQL assertions, TAP reporting, and isolated xUnit-style execution. Teams should plan for host installation, PostgreSQL version requirements, and the license’s lack of support obligations.
What the maker publishes
- Database behavior
- Tests can exercise database views, procedures, functions, rules, and triggers. source
- Database requirement
- The package documentation says pgTAP requires PostgreSQL 9.1 or higher. source
- Database testing
- Its assertion functions can test database values and exercise views, procedures, functions, rules, and triggers. source
- Hosting requirement
- pgTAP must be installed on a host with PostgreSQL running and cannot be installed remotely. source
- Installation
- pgTAP must be installed on a host running PostgreSQL and cannot be installed remotely. source
- Integration guidance
- The integration page mentions PHP and Python testing frameworks but says users should send instructions for those integrations to the project's mailing list. source
- Integrations
- The integration guide provides instructions for Perl and PostgreSQL module workflows, and mentions PHP and Python testing frameworks. source
- Integrations
- The integration guide describes running pgTAP tests with Perl's Test::Harness and TAP::Harness, and with PostgreSQL module testing tools. source
- Latest listed release
- PGXN lists pgTAP 1.3.4 as the stable release, dated 2025-10-04. source
- License
- The release page grants permission to use, copy, modify, and distribute the software and documentation without fee, subject to its stated conditions. source
- License
- The PGXN package page grants permission to use, copy, modify, and distribute pgTAP and its documentation without a fee, subject to the stated conditions. source
- PostgreSQL requirement
- The release page says pgTAP requires PostgreSQL 9.1 or higher. source
- Purpose
- pgTAP is a suite of database functions for writing TAP-emitting unit tests for PostgreSQL. source
- Purpose
- pgTAP is a PostgreSQL unit testing framework that emits TAP from psql scripts or xUnit style test functions. source
- Schema testing
- Its functions can check database schema objects, including tables, columns, primary keys, and function signatures. source
- Schema testing
- The framework includes functions for checking schema objects such as tables, columns, and primary keys. source
- Support
- The license says the author has no obligation to provide maintenance, support, updates, enhancements, or modifications. source
- Support terms
- The package license disclaims any obligation to provide maintenance, support, updates, enhancements, or modifications. source
- Test isolation
- The xUnit-style runtests() function rolls back changes made to the schema during each test and supports setup, teardown, startup, and shutdown functions. source
- Test output
- pgTAP emits TAP output that can be collected and reported by a TAP harness. source
- Test runner
- The pgTAP site describes running tests with pg_prove. source
- Test runner
- pg_prove can run pgTAP tests and display TAP results. source
- Test styles
- It supports tests in psql scripts and xUnit-style test functions. source
- Test styles
- pgTAP supports both scripting style tests and xUnit style tests, including setup and teardown functions for xUnit tests. source
Checked against the maker's pages on 3 Oct 2026.