Testing Area/Behat Testing/Setup: Difference between revisions
From Mahara Wiki
< Testing Area | Behat Testing
Srynot4sale (talk | contribs) No edit summary |
|||
Line 105: | Line 105: | ||
Install Behat's dependencies: | Install Behat's dependencies: | ||
sudo apt-get install curl openjdk-7-jre-headless | 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. | |||
Add these config settings to the bottom of your config.php file. | |||
{{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}} | {{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}} | ||
Line 119: | Line 114: | ||
// Behat config | // Behat config | ||
$cfg->dbprefix = ''; // Behat complains without this | $cfg->dbprefix = ''; // Behat complains without this | ||
$cfg->wwwroot = 'http://mahara/'; | $cfg->wwwroot = 'http://your.mahara.domain/'; // Add this is you do not have wwwroot set already, Behat complains with out it | ||
$cfg->behat_dbprefix = 'behat_'; // must not empty | $cfg->behat_dbprefix = 'behat_'; // must not empty | ||
$cfg->behat_dataroot = "/var/lib/maharadata | $cfg->behat_dataroot = "/var/lib/maharadata/behat"; // Behat's copy of mahara data | ||
$cfg->behat_wwwroot = 'http://localhost:8000'; | $cfg->behat_wwwroot = 'http://localhost:8000'; // Must be this | ||
</pre> | </pre> | ||
Make | Make your data directory (check this matches what you set in config.php): | ||
sudo mkdir /var/lib/maharadata | sudo mkdir /var/lib/maharadata/behat | ||
Make directory writeable by mahara (check this is correct): | Make directory writeable by mahara (check this is correct): | ||
sudo chmod 777 /var/lib/maharadata | sudo chmod 777 /var/lib/maharadata/behat | ||
Run Behat tests (change into your Mahara code directory first) | Run Behat tests (change into your Mahara code directory first) | ||
Line 136: | Line 131: | ||
For the first time of running behat, you need to wait for the Behat environment initialisation. This can take a while. | 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 @yourtags | |||
To run your specific tests: | |||
./test/behat/mahara_behat.sh run @yourtags | ./test/behat/mahara_behat.sh run @yourtags | ||
[[Category:Behat]] | [[Category:Behat]] |
Revision as of 10:19, 17 February 2015
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
Install Apache, PHP5, Database, Git:
sudo apt-get install php5 php5-cli php5-pgsql php5-xmlrpc php5-intl php5-curl php5-gd php5-xdebug php5-dbg postgresql apache2 git
Restart Apache
sudo service apache2 restart
Make a Mahara directory in the same place as Moodle
sudo mkdir /var/www/html/mahara
Then change into the Mahara directory
cd /var/www/html/mahara
Then change the permission (insert the username of the machine into the username. Don't use the word username)
sudo chown username:username /var/www/html/mahara
Get Mahara clone.
git clone https://github.com/MaharaProject/mahara.git .
Checkout the master(15.04) branch
git checkout master
Note: if this step doesn't work. You may have forgotten the fullstop off the end of the git clone command. It created a mahara directory inside the other mahara directory. Go in to the file explorer and delete the second instance.
Become Postgres user:
sudo su postgres
Open psql. After some preamble you should see the prompt postgres=#.
psql
You should now see postgres=# ready and awaiting your command.
Create a user and don't use the PW that you use for your workstation:
CREATE USER maharauser WITH PASSWORD 'yourpassword';
As you previously did, you should see postgres=# You are now going to create a database:
CREATE DATABASE mahara WITH OWNER maharauser;
Exit to leave psql by pressing Ctrl-D
Exit back to your own user:
exit
Make a data directory:
sudo mkdir /var/www/maharadata
Make directory writeable by mahara:
sudo chmod 777 /var/www/maharadata
In the code below make sure you change <your email address> to your actual work email address, without the <> signs.
<?php $cfg = new stdClass(); $branch = 'master'; // database connection details // valid values for dbtype are 'postgres8' and 'mysql5' $cfg->dbtype = 'postgres'; $cfg->dbhost = 'localhost'; $cfg->dbuser = 'maharauser'; $cfg->dbname = "mahara"; $cfg->dbpass = 'password'; $cfg->dataroot = "/var/www/maharadata"; $cfg->sendemail = true; $cfg->sendallemailto = '<your email address>'; $cfg->productionmode = false; $cfg->perftofoot = true;
An example config.php should appear:
- Copy all of the code above
- open text editor from start menu
- paste code
- save file in the directory: /var/www/html/mahara/htdocs/ and call it config.php
- save
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.
// Behat config $cfg->dbprefix = ''; // Behat complains without this $cfg->wwwroot = 'http://your.mahara.domain/'; // Add this is 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 @yourtags
To run your specific tests:
./test/behat/mahara_behat.sh run @yourtags