Disclaimers:
- I'm hoping this will help you understand so you can help us improve our documentation.
- This is simplified version, i'm ignoring some details which are unimportant for discusing this.
1/ A Moodle instance running on a webserver which you can connect to, just like you use for development and manual testing. One requirement we put on behat is that this runs on a different wwwroot to your 'normal' moodle install. So you will need to configure apache to listen on two urls for the same moodle checkout if you want to run tests manually. e.g.
$CFG->wwwroot = 'http://dan.moodle.local/' $CFG->behat_wwwroot = 'http://127.0.0.1/'
2/ A seperate database prefix and dataroot (just like phpunit):
$CFG->behat_prefix = 'behat_'; $CFG->behat_dataroot = '/Users/danp/moodles/im/moodledata_behat';
2/ Selenium. Download the jar and run it.
3/ Behat installed from composer. The admin tool will attempt to do it:
php admin/tool/behat/cli/init.php
Run the behat command which "php admin/tool/behat/cli/init.php" tells you to do:
vendor/bin/behat --config /Users/danp/moodles/pm_behating/moodledata_behat/behat/behat.yml
There tend to be three things which can stop it from working:
- Composer problems (I guess this generally works ok on windows, since phpunit doesn't seem to be plagued the same)
- Behat can't connect to selenium (How to debug - is it running, can you telnet and connect on the selenium port?)
- The selenium browser can't connect to your webserver (can you connect to your $CFG->behat_wwwroot in a browser?)
any updates on how to fix this issue?
After running php admin/tool/behat/cli/init.php
Acceptance tests environment enabled on http://127.0.0.1
After running php admin/tool/behat/run.php
The base URL (http://127.0.0.1) is not a behat test site, ensure you started the built-in web server in the correct directory or your web server is correctly started and set up