Using test-runner script

For the convenience of running automatic tests it’s recommended to use $ ./scripts/tests-runner.sh BASH script, which automates whole process of setting up the server (and database, with correct configuration and components being enabled), running desired tests as well as generating summary page.

Running it without any parameter will print a help with description of the possible options:

$ ./scripts/tests-runner.sh
Can't find settings file: ./scripts/tests-runner-settings.sh using defaults
Tigase server home directory: tmp/tigase-server
Version: 7.2.0-SNAPSHOT-b4823
Output dir: files/test-results/7.2.0-SNAPSHOT-b4823
Run selected or all tests for defined server
----
  --all-tests [(database)] :: Run all available tests
          (database) is an array, if database is missing tests will be run against all configured ones
                     possible values: derby, mysql, postgresql, sqlserver, mongodb
  --custom <package.Class[#method]]> [(database)] :: Run defined test, accepts wildcards, eg.:
          --custom tigase.tests.util.RetrieveVersion
  --help :: print this help
----
  Special parameters only at the beginning of the parameters list
  --debug|-d                   Turns on debug mode
  --skip-rebuild-tts|-srb      Turns off rebuilding TTS-NG and only runs already build tests
  --skip-summary-page-get|-sp  Turns off automatic generation of Summary Page
  --download-latest|-dl        Turns on downloading latest Tigase Server release
  --reload-db|-db              Turns on reloading database
  --start-server|-serv         Turns on starting Tigase server
-----------
  Other possible parameters are in following order:
  [server-dir] [server-ip]

Majority of those are self-explanatory. By default, the script will only rebuild all test cases, run them and then generate Summary page and place the output in the files subdirectory (if not configured otherwise, see the section called “Test Runner settings”).

After --all-tests and --custom <test_case> options it’s possible to specify a space-delimited list of databases for which tests should be run (they will match database and server IPs defined in the section called “Test Runner settings”).

By appending following options

Test Runner settings

It’s possible to adjust default Test Runner settings by copying distribution settings and adjusting it to your needs:

$ cp scripts/tests-runner-settings.dist.sh scripts/tests-runner-settings.sh

Following configuration options are available:

  • database configuration:

    • db_name - name of the database to be created,
    • db_user, db_pass - name and password of the basic user, which will be used by Tigase,
    • db_root_user, db_root_pass - name and password of the database root user, which will be used to create all necessary databases and grant roles.
  • databases selection

    • DATABASES=("derby" "mysql" "postgresql" "sqlserver" "mongodb") - a list of databases which will be tested
    • DATABASES_IPS=("127.0.0.1" "127.0.0.1" "127.0.0.1" "sqlserverhost" "127.0.0.1") - a list of IPs of the databases which will be used while testing particular database, i.e. if you have a list of 3 databases in DATABASE for each item/index respective item from this array will be used (so for first item derby from DATABASES, first item from DATABASES_IPS will be used;
    • IPS=("127.0.0.1" "127.0.0.1" "127.0.0.1" "127.0.0.1" "127.0.0.1") - a list of IPs of the servers which will be used while testing particular database, i.e. if you have a list of 3 databases in DATABASE for each item/index respective item from this array will be used (so for first item derby from DATABASES, first item from IPS will be used as a server IP to which connection will be made.
  • server_timeout=15 - a timeout in seconds used to delay subsequent actions/tasks (for example to allow server proper startup)
  • server_dir="../tigase-server/server" - server directory which will be used to reload database (if enabled) and start the server (if enabled)
  • tigase_distribution_url="http://build.tigase.org/nightlies/dists/latest/tigase-server-dist-max.tar.gz" - link which will be used to download latest release of Tigase XMPP Server
  • memory configuration for normal tests: MS_MEM=100 and MX_MEM=1000 (minimum and maximum JVM heap size respectively) and low memory tests: SMALL_MS_MEM=10, SMALL_MX_MEM=50 (minimum and maximum JVM heap size respectively)
  • ROOT_DIR=./files/ - a root directory where tests results will be stored and where summary page will be placed (in not disabled)