Unit test frameworks
The example in the previous section has more drawbacks. For example, if the function being tested raises warnings or notices, they will spoil the test protocol. Moreover, the testing code is not clean; the same pieces of code are repeated several times, those BEGIN, and END blocks are bulky, and the resulting protocol is not formatted very well. All these tasks could be automated using any of the unit test frameworks.
There is no unit test framework that comes out of the box with PostgreSQL, but there are several available from the community.
One of the most commonly-used ones is pgtap (http://pgtap.org/). It is available in the PGDG apt repository for Debian and Ubuntu Linux distributions (https://www.postgresql.org/about/news/1432/ ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access