Test course generator

From MoodleDocs

If you want a sample course for load testing or reliability of a feature (where its behaviour might depend on the size of a course), you can generate standardized test courses using the generator tool at Administration > Site administration > Development > Make a test course.,

Warning: This tool is for developer use only! Courses created using this feature can occupy a large amount of database and consume disk space (tens of gigabytes). Although you can delete those courses (and wait for various cleanup runs) to release the space they consumed, this tool should not be used on a live site. For safety it is disabled unless you set Site administration > Development > Debugging: Debug messages to DEVELOPER.

Using the tool

  1. First set the debugging level to DEVELOPER as mentioned in the warning above.
  2. If you want to set a password for all the generated users, add the line "$CFG->tool_generator_users_password = 'YOURSECRET';" to config.php of Moodle. If the password does not comply with the site security policy to set "$CFG->passwordpolicy = 0;" too.

GUI version

  1. Visit Administration > Site administration > Development > Make a test course. make-test-course.png

Options

  • Size of course: You can choose amoung XS, S, M, L, XL, or XXL (required). The table below shows their difference.

Please note that bigger courses take longer to be created - the biggest up to 4 hours on a decent server. Your server may run out of space or time out if it can't handle the size you selected.

Size of course Approx. size No. of assignments No. of pages No. of small files No. of big files No. of sections No. of users No. of forum posts Approx. time to create
XS 10 kB 1 1 1 1 1 1 2 1 sec
S 10 MB 10 50 64 2 10 100 20 30 sec
M 100 MB 100 200 128 5 100 1,000 500 2 min
L 1 GB 500 1,000 1,024 10 500 10,000 5,000 30 min
XL 10 GB 1,000 5,000 16,384 10 1,000 50,000 10,000 2 hours
XXL 20 GB 2,000 10,000 32,768 10 2,000 100,000 20,000 4 hours
  • Course short name: The course short name (required)
  • Course full name and Course summary: (optional)

Sample output

 Creating course
 Creating [Course name]
 Creating assignments (100): . . . . . . . . . . . . done (12.7s)
 Creating pages (200): . . done (1.5s)
 Creating small files (128): done (0.4s)
 Creating big files (5): . done (1.3s)
 Checking user accounts (1000)
 Creating user accounts (1 - 1000): . . . . . . . . done (8.7s)
 Enrolling users into course (1000): . . . . . . done (5.7s)
 Creating forum (500 posts): . . done (1.7s)
 Course completed (32.2s)

CLI version

You can run the tool from the command-line using:

php admin/tool/generator/cli/maketestcourse.php

This will show command-line options.

Options

In addition to the options in the GUI version the CLI command has the following options:

  • Use a fixed dataset: Use a fixed data set instead of randomly generated data, useful for generating a standard data set
  • Specify a file size limit: Limits the size of the generated files to the specified number of bytes, you may find this setting useful because depending on the size you select the courses can use too much disk space
  • By pass check: Bypasses the developer-mode check
  • Quiet: Do not show any output