Skip to content

Running the test suite

Jan Stolarek edited this page Nov 13, 2018 · 10 revisions

To run the Links test suite execute:

./run-tests

This will run all the tests defined in *.tests files inside tests directory, as well as all database tests defined inside tests/database directory. If you only want to run some of the tests you can do this by executing

./test-harness tests/foo.tests

where foo.tests is the name of the file with tests you want to run. If you want to skip tests requiring database access run

./run-tests no-db

If you want to run only those tests that require database access run

./run-tests db-only

To run the tests requiring database access you need to setup PostgreSQL database. Refer to Database setup for instructions how to compile Links with PostgreSQL support. You also need to create links database and have permissions to access it.

To run shredding tests, run

./run-tests db-only shredding

To configure tests to run using an alternate database configuration (user+password/host), edit the config files in tests/{database,shredding}/config. These are created from the respective sample files if they do not exists, but will not be overwritten if they are already there.

Creating new database tests

Each database test should consist of a pair of files: SQL database setup script (.sql extensions) + Links test code (.links extension). Both files should have identical base name and should be placed in a directory containing database tests (at the moment tests/database/ and tests/shredding are such directories). Each directory contains:

  • config.sample - a default database configuration for tests in a given directory
  • config - actual database configuration for tests in a given directory. This file is ignored by git and can be freely edited to match the local database steup. If config file does not exist it will be created from config.sample by run-tests script.
  • testsuite.config - list of tests to run from a given directory. Each line should contain a name of a test to run. If a test is known to fail precede its name with word BROKEN, e.g. BROKEN xpath.
Clone this wiki locally