Actions

Testing/Behat Testing/Setup

From Mahara Wiki

< Testing/Behat Testing
Revision as of 10:46, 24 June 2015 by Anitsirk (talk | contribs) (Otherwise, if you do not have Mahara installed)

How to install Mahara and Behat

Note: These instructions for Mahara and Behat setup are only for machines running Linux. They will not work for Windows machines


For dev's instructions to install a Mahara

Please use System_Administrator's_Guide/Installing_Mahara.


Otherwise, if you do not have Mahara installed

Follow the instructions for setting up Mahara.

Note: If you do have Mahara already installed, skip to #Behat_installation


Behat installation

Install Behat's dependencies:

sudo apt-get install curl openjdk-7-jre-headless

Add these config settings to the bottom of your Mahara config.php file, inside the htdocs/ subdirectory of the Mahara codebase.

Note: If /var/www/maharadata is not where you created your dataroot, you'll need to replace that with the correct path in the following commands
// Behat config
$cfg->dbprefix = ''; // Behat complains without dbprefix being set
$cfg->wwwroot = 'http://your.mahara.domain/';  // Add this if you do not have wwwroot set already, Behat complains with out it
$cfg->behat_dbprefix = 'behat_'; // must not empty
$cfg->behat_dataroot = "/var/lib/maharadata/behat"; // Behat's copy of mahara data
$cfg->behat_wwwroot = 'http://localhost:8000'; // Must be this

Make your data directory (check this matches what you set in config.php):

sudo mkdir /var/lib/maharadata/behat

Make directory writeable by mahara (check this is correct):

sudo chmod 777 /var/lib/maharadata/behat

Run Behat tests (change into your Mahara code directory first)

./test/behat/mahara_behat.sh run

For the first time of running behat, you need to wait for the Behat environment initialisation. This can take a while.

To run all tests

./test/behat/mahara_behat.sh run

To run your specific tests:

./test/behat/mahara_behat.sh run @yourtags