regression testing tool for Postgres
Documentation
Originally inspired by pg_regress
, pg_yregress
provides
a TAP-compatible test executor that allows for
better test organization, easier instance management, native JSON handling and
so on.
pg_regress
drives a psql
session and your tests are essentially an stdout
capture.
pg_yregress
organizes tests and expectations in a YAML document, making tests
easier to maintain and use.
- TAP reporting
- Grouped & structured tests
- Single-file test/expectation management
- Built-in JSON handling
- Binary type encoding testing
- Transaction management
- Deep instance configurability
- Testing Postgres extensions
- Verifying complex SQL queries or behaviors
- Stored function testing
- Data health checks
Tests are written in YAML files (for clarity) and can be executed using
pg_yregress <file.yml>
.
This test simply tests for the success of the query:
tests:
- select 1
This tests the result:
tests:
- query: select 1 as result
results:
- result: 1
This tests against JSON structures
tests:
- query: select json_value from table
results:
- json_value:
test: value
For more examples and use cases, check out documentation.
brew install omnigres/omnigres/pg_yregress
cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build --parallel
# Install
cmake --install build
This build will be using user- or system-installed Postgres.
pg_yregress test.yml
It will print TAP output for all the tests. To simplify the output, TAP printers like tapview can be used:
$ pg_yregress test.yml | tapview
...........................................................................ss.sss..xx.uuu...
92 tests, 0 failures, 5 TODOs, 5 SKIPs.
- Discord server: come and chat with out pg_yregress users.