Selenium scripts for performance testing of Moodle sites
- Moodle -- download.moodle.org
- Firefox -- getfirefox.com
- Selenium IDE Firefox plugin -- docs.seleniumhq.org/download/
You will need to modify the test scripts to use relevant ID numbers for your own system as well as valid usernames for the users logging in with each set of tests before these will work in other places.
-
Copy the
test_cachepurge.php
andtest_login.html
files into the root of your Moodle site -
Edit the
test_login.html
file so that theaction="/login/index.php"
piece points to the login script on your Moodle site (assuming that /login/index.php doesn't already) -
Disable HTTP caching in your browser:
- Type
about:config
into the address bar - Search for
network.http.use-cache
- Double click the value to set it to false
- Type
-
Open the Selenium IDE plugin Firefox and load the
perftest.selenium.html
as a test suite -
Edit the base URL in the Selenium IDE to point to the root of your Moodle site
-
Edit the
config.php
file on your Moodle site to add the following lines somewhere before the require for setup.php:define('MDL_PERF', true); define('MDL_PERFTOLOG', true);
-
(Optional) Empty / erase the error log file for the web server that is running your Moodle site
-
Hit the Play entire test suite button
-
When the test suite has finished running, you can run the included
perf_log_analysis.php
script on your web server's error log file to print out some formatted analysis output as well as a CSV file containing the raw data results which can be imported into any spreadsheet program for formatting and generating graphs.
See my original blog posts about performance testing Moodle: