This post is part of the Moodle Oktobertest series.
iMacros records your web browsing activity so that you can later simulate the actions of a real Moodle user, all automatically. For example, you start up Firefox and set iMacros to record. You go about your daily business on Moodle as normal (e.g. login, view your course, add an assignment, answer some forum posts and logout), iMacros keeps a record of everything you click on during your session, including all the forms that you fill in until you press ‘Stop recording’. Those steps are saved in a macro, which you can then play back later by opening that macro. This means that you can press the ‘play’ button and Firefox will repeat all of the steps that you did during your session, without any more interactions from your part, thus automatically simulating the web browsing activities of a Moodle user. You can ‘loop’ the action to repeat it automatically as many times as you like.
Before you start following this tutorial, you should download the following:
You might also be interested in reading this blog post, where you can find real world examples of iMacros macros (!).
Step 1: Open iMacros
- Click on the iMacros icon
- Open the webpage where you want to start your test from
- Click on the ‘Rec’ icon
Step 2: Start recording your macro
- Click the ‘Record’ button
- As you navigate your Moodle site, you will see that lines of text are added to this box, this is normal
- Make sure that the ‘Click mode’ is set to ‘Auto’
Step 3: Stop recording when you’re happy
- Click ‘Stop’ when you have finished navigating your Moodle site
- The macro you have just recorded is called ‘current.iim’. I strongly advise you to rename it to something else, as every time you click the ‘record’ button it overwrites the ‘current.iim’ file (simply right-click on the file name to rename it)
Step 4: Try it
Try and play your macro just to make sure it works
- Click on the ‘Play’ tab
- Click on the ‘Play’ button (make sure the correct macro file is selected)
- Sit back and relax
If you want to loop your macro, take a look at this webpage.
Step 5: Load test
The macro you recorded will only mimic one user when you play it – hardly useful for load testing. To mimic multiple users at once, you will need to run multiple instances of the macro at the same time. Note that using different tabs will not work, you have to open each new instance of Firefox in its own window. (Ctrl N on Windows/Linux, or Cmd N on Mac). The only limitation is the amount of instances your computer can cope with in terms of CPU/RAM and bandwidth.
It is also possible to run the macro from command line or task scheduler. Procedures differ depending on the platform you use, so instead of me re-inventing the wheel, please check the following links:
- Task scheduler on Windows, and here
- Command line in Mac OS X (possibly works in Linux)