This space is archived
For current information please use the current ExamSys documentation
Automatic functional testing
How to install and run
Installation
- Do a normal install on the machine you wish to test on (this is so a valid configuration file is present)
Create a behat.xml file in your config directory. It should contain the following settings:
behat.xml<?xml version="1.0" encoding="UTF-8"?> <rogo> <website>http://localhost:8000/</website> <db_database>behat_database_schema_name</db_database> <db_user>username</db_user> <db_password>password</db_password> <data>path_to_behat_user_data</data> <faildump>path_for_screenshots_of_failures</faildump> </rogo>
- Run the following script:
testing/behat/cli/init.php
- Download selenium (V3.x is supported) from http://www.seleniumhq.org/download/
- Download ChromeDriver from https://sites.google.com/a/chromium.org/chromedriver/
Note for Windows users
You will need to install composer.phar into the root rogo directory manually from https://getcomposer.org/download/
Running
- Start the webserver referenced in behat's website setting. You can use the builtin php web server with the following command:
php -S localhost:8000
- Start Selenium with a command similar to:
java -Dwebdriver.chrome.driver=<path_to_chromedriver> -jar selenium-server-standalone-<version_number>.jar
- Run the following command to run the test suite:
vendor/bin/behat --config <rogo_root_directory>/testing/behat/config/behat.yml
Additional information
Alternative configuration
It is also possible to configure behat using the main Rogo config using the following settings:
- $cfg_behat_website - Should be a url and specific port, for example http://localhost:8000/
- $cfg_behat_db_database - Should be the name of a database schema that is different to the live schema, but on the same server
- $cfg_behat_data - The location that you wish behat to store user data files, must be different to the value of $cfg_rogo_data
- $cfg_behat_db_user - Username that can be used to fully control your database
- $cfg_behat_db_password - The password for the database user
Useful information
How to install and run on Docker
Start up rogo docker
docker-composedocker-compose -f docker-compose.yml -f db.yml -f expose.yml -f selenium.yml up -d
- Install rogo
Create a behat.xml file in your config directory. It should contain the following settings:
behat.xml<?xml version="1.0" encoding="UTF-8"?> <rogo> <website>http://web:8003</website> <db_database>behat_database_schema_name</db_database> <db_user>username</db_user> <db_password>password</db_password> <data>path_to_behat_user_data</data> </rogo>
- Run the following script: testing/behat/cli/init.php on the web service.
- Start the webserver referenced in behat's website setting. You can use the builtin php web server with the following command: php -S localhost:8003
- Overwrite the generated /testing/behat/config/behat.yml file with the location of the selenium service:
... ... extensions: Behat\MinkExtension: base_url: 'http://web:8003' goutte: null selenium2: browser: chrome wd_host: 'selenium:4444/wd/hub'
5. Run the following command to run the test suite: vendor/bin/behat --config <rogo_root_directory>/testing/behat/config/behat.yml
Ideas for the future
We can probably set things up so that our tests will run automatically in the cloud on something like: https://travis-ci.com/