Testing Area/Behat Testing/Setup: Difference between revisions
From Mahara Wiki
< Testing Area | Behat Testing
No edit summary |
No edit summary |
||
Line 32: | Line 32: | ||
</source> | </source> | ||
6. Run Behat tests (change into your Mahara code directory first): | 6. Make the directory is owned by apache user (check this is correct): | ||
<source lang="bash" enclose="div"> | |||
$ sudo chown www-data.www-data /var/lib/maharadata/behat | |||
</source> | |||
* For Ubuntu, apache runs with user www-data | |||
* For Centos, apache runs with user apache | |||
7. Run Behat tests (change into your Mahara code directory first) as the apache user: | |||
<source lang="bash" enclose="div"> | <source lang="bash" enclose="div"> | ||
$ cd | $ cd | ||
Line 38: | Line 46: | ||
./test/behat/mahara_behat.sh run | ./test/behat/mahara_behat.sh run | ||
</source> | </source> | ||
Or if you have sudo access: | |||
<source lang="bash" enclose="div"> | |||
$ cd | |||
$ cd code/mahara | |||
sudo -u www-data ./test/behat/mahara_behat.sh run | |||
</source> | |||
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. |
Revision as of 16:34, 3 August 2016
1. Set up your developer environment if you haven't already done so.
2. Install Behat's dependencies:
$ sudo apt-get install curl openjdk-7-jre-headless
3. Add the following config settings to the bottom of your Mahara config.php file inside the htdocs/ subdirectory of the Mahara codebase.
// Behat config
$cfg->behat_dbprefix = 'behat_'; // must not empty
$cfg->behat_dataroot = "/var/lib/maharadata/master_behat"; // Behat's copy of maharadata
$cfg->behat_wwwroot = 'http://localhost:8000'; // Must be this
4. Make your Behat data directory (check this matches what you set in config.php):
$ sudo mkdir /var/lib/maharadata/master_behat
5. Make the directory writeable by Mahara (check this is correct):
$ sudo chmod 777 /var/lib/maharadata/behat
6. Make the directory is owned by apache user (check this is correct):
$ sudo chown www-data.www-data /var/lib/maharadata/behat
- For Ubuntu, apache runs with user www-data
- For Centos, apache runs with user apache
7. Run Behat tests (change into your Mahara code directory first) as the apache user:
$ cd
$ cd code/mahara
./test/behat/mahara_behat.sh run
Or if you have sudo access:
$ cd
$ cd code/mahara
sudo -u www-data ./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 marked with @yourtags:
./test/behat/mahara_behat.sh run @yourtags
To run a particular feature file:
./test/behat/mahara_behat.sh run my_file.feature
The run / runheadless / rundebug / rundebugheadless / runfresh are interchangable with run in above commands