Skip to content

Commit 60e3014

Browse files
authored
Merge pull request #987 from ferranrecio/MDL-80096-main
[general] document tool_generator features
2 parents 953dfe2 + 063ffca commit 60e3014

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
---
2+
title: Generator tool
3+
tags:
4+
- tools
5+
- Generator
6+
- Testing
7+
- Behat
8+
---
9+
<!-- cspell:ignore JMeter -->
10+
11+
## Introduction
12+
13+
The Generator tool is a Moodle administration tool that allows you to generate test data for your Moodle site.
14+
It is helpful for testing and development purposes, as it can create a large number of users, courses, and other
15+
entities in a short time.
16+
17+
The tool provides several features to help you generate test data, such as:
18+
19+
1. Make test course: Create a course with a specified number of sections, activities and enrolled users.
20+
1. Create testing scenarios: can execute behat generators on the current instance.
21+
1. Test plan: generates JMeter test plans for the current instance.
22+
1. Make test site: Create a site with a specified number of courses, users, and activities.
23+
24+
## Generator requirements
25+
26+
All generator tools are meant to be used in a development environment only. To prevent accidental use in a
27+
production environment, the generator tools require the instance to have the debug level set to developer.
28+
29+
To set the debug level to developer, go to `Site administration > Development > Debugging` and set the debug
30+
messages to `DEVELOPER: extra Moodle debug messages for developers`.
31+
32+
## Create a test course
33+
34+
Creating a testing course could be done on both web and CLI.
35+
36+
To create the course via web, go to `Site administration > Development > Make test course`. Once there,
37+
you can specify the course size, short name, full name, and description. The tool will create a course with
38+
some activities, and some users enrolled.
39+
40+
To create the course via CLI, you can use the following command:
41+
42+
```bash
43+
php admin/tool/generator/cli/maketestcourse.php --shortname=SIZE_S --size=S
44+
```
45+
46+
## Create a testing scenario using behat generators
47+
48+
The Generator tool allows you to execute behat generators on the current instance. This can be done on the web or the CLI.
49+
50+
Before executing the behat generators, you need to have the `feature` file you want to execute. It is important to
51+
note that the tool does not use `selenium` or any other browser wrapper.
52+
53+
This means:
54+
55+
1. The tool will only execute generator steps. If any other type of step is present in the `feature` file,
56+
it will show a parsing error.
57+
1. For now, the tool can only execute normal scenarios. It does not support background, outline, or scenario
58+
outline scenarios.
59+
60+
To execute the behat generators via web, go to `Site administration > Development > Create testing scenarios`.
61+
Once there, you can upload the `feature` file you want to execute and see the the execution results.
62+
63+
To execute the behat generators via CLI, you can use the following command:
64+
65+
```bash
66+
php admin/tool/generator/cli/runtestscenario.php --feature=/path/to/some/testing/scenario.feature
67+
```

0 commit comments

Comments
 (0)