Page tree
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 12 Next »

On This Page:

Setting Up the Test Framework.

A guide to setting up the Revive Adserver development test framework .

 


Pre-Requisites

In order to set up the Revive Adserver development test framework, you will need:

Copy & Configure the Test Configuration File

In your Revive Adserver development environment:

  • Copy the /etc/test.conf.php file to the /var directory;
  • Edit the /var/test.conf.php file:
    • In the [database] section:
      • Set the appropriate database type;
      • Set the appropriate host of your database;
      • If required, set the socket or port;
      • Set an appropriate username and password to connect to the database with (not that this username will need permissions to create, modify and drop the test database); and
      • Set the name of the test database, if a different name is needed.

 

If tests are failing with HTTP 500 errors, the database connection details in the test.conf.php file may be the cause.

In particular, when using a MySQL database, the mysql4_compatibility setting may be relevant.

If you are still not having any luck setting the value(s) for the [database] section manually, try copying a known good [database] section from the Revive Adserver development environment - but remember to update the details for the database name & any other required values.

 

  • Update the ownership or permissions of the /var/test.conf.php file to allow your web server user to write to this file.

Accessing the Test Framework via a Web Browser

To access the test framework via a web browser, point your browser at the /tests directory of your Revive Adserver development environment. 

So, for example, if your Revive Adserver development environment is accessible at http://www.example.com/revive-adserver, then the test framework will be available at:

Test Execution

Web Browser

To execute tests, or a group of tests, simple click on the test (or group) in the web UI.

Many of the tests, especially those that access the database, are known to leave data/the database in an invalid state that affect the running of the next test, which results in false negative test results.

This is a known issue with the Test Framework's web UI. Nevertheless, the web UI is a particularly effective way of executing tests, particularly a specific test, for the purposes of checking a specific area of functionality, or to execute a test via xdebug.

However, for bulk test execution (e.g. prior to committing code or releasing Revive Adserver), the command line is a far better way to execute all tests.

Command Line

To run all of the unit tests, the following commands can be used:

cd /path/to/revive/tests
/path/to/php -q cli_test_runner.php /path/to/php unit

(warning) Be aware the output is in XML, for some reason - this needs tracking down and fixing!

Alternatively, to run all of the integration tests, replace "unit" with "integration".

When running tests via a web browser and the command line, permissions can be an issue.

Running tests via the web browser will create test files & cache data in various directories that are owned by the web server user. However, running tests via the command line will create test files & cache data as the user which executes the test command.

To ensure that tests work in both environments, you may need to either:

  • Ensure that you run the command line tests as the same user that the web server runs under; or
  • Bulk assign read/write permissions to the following directories & files:
    • Everything in Revive Adserver's /var directory.
  • No labels