summaryrefslogtreecommitdiff
path: root/src/test/perl/README
diff options
context:
space:
mode:
authorAlvaro Herrera <alvherre@alvh.no-ip.org>2016-02-25 21:31:52 -0300
committerAlvaro Herrera <alvherre@alvh.no-ip.org>2016-02-25 21:31:52 -0300
commite64009303d4e2434abafbdafe4d571cc4f279d39 (patch)
treef1904178fa50379277b804138f97e28c20e87a7c /src/test/perl/README
parentbda0b081984011ba5347bf3eecc95b71833de082 (diff)
Add POD docs to PostgresNode
Also, the dump_info method got split into another method that returns the stuff as a string instead of just printing it to stdout. Add a new README in src/test/perl too. Author: Craig Ringer Reviewed by: Michaƫl Paquier
Diffstat (limited to 'src/test/perl/README')
-rw-r--r--src/test/perl/README53
1 files changed, 53 insertions, 0 deletions
diff --git a/src/test/perl/README b/src/test/perl/README
new file mode 100644
index 00000000000..7b6de5f0b6f
--- /dev/null
+++ b/src/test/perl/README
@@ -0,0 +1,53 @@
+Perl-based TAP tests
+====================
+
+src/test/perl/ contains shared infrastructure that's used by Perl-based tests
+across the source tree, particularly tests in src/bin and src/test. It's used
+to drive tests for backup and restore, replication, etc - anything that can't
+really be expressed using pg_regress or the isolation test framework.
+
+You should prefer to write tests using pg_regress in src/test/regress, or
+isolation tester specs in src/test/isolation, if possible. If not, check to
+see if your new tests make sense under an existing tree in src/test, like
+src/test/ssl, or should be added to one of the suites for an existing utility.
+
+Writing tests
+-------------
+
+Tests are written using Perl's Test::More with some PostgreSQL-specific
+infrastructure from src/test/perl providing node management, support for
+invoking 'psql' to run queries and get results, etc. You should read the
+documentation for Test::More before trying to write tests.
+
+Test scripts in the t/ subdirectory of a suite are executed in alphabetical
+order.
+
+Each test script should begin with:
+
+ use strict;
+ use warnings;
+ use PostgresNode;
+ use TestLib;
+ # Replace with the number of tests to execute:
+ use Test::More tests => 1;
+
+then it will generally need to set up one or more nodes, run commands
+against them and evaluate the results. For example:
+
+ my $node = get_new_node('master');
+ $node->init;
+ $node->start;
+
+ my $ret = $node->psql('postgres', 'SELECT 1');
+ is($ret, '1', 'SELECT 1 returns 1');
+
+ $node->stop('fast');
+
+Read the Test::More documentation for more on how to write tests:
+
+ perldoc Test::More
+
+For available PostgreSQL-specific test methods and some example tests read the
+perldoc for the test modules, e.g.:
+
+ perldoc src/test/perl/PostgresNode.pm