-
Functional Test
-
Minor
-
Moodle 2.8
Requisites:
- To have the xhprof php extension installed and available.
- To have the "dot" executable available.
Settings:
- Instead of doing that from the admin UI, put these lines in your config.php:
$CFG->earlyprofilingenabled = true;
|
$CFG->profilingenabled=true;
|
$CFG->profilingautofrec = 5;
|
$CFG->profilingincluded = '/*view.php,/*index.php';
|
$CFG->profilingallowme = true;
|
$CFG->profilingallowall = true;
|
$CFG->pathtodot = '/path/to/your/executable/dot';
|
Testing:
1) Log into your site as admin.
2) Reload the front page around 10-20 times (or navigate around different index.php and view.php files) and look to the footer. Randomly (the settings above define one frequency of 1/5) you will see the message "This script has been profiled".
3) Go to various pages of moodle (course/view, participant list, backup...) and add the "PROFILEME" param to the URL (don't forget the & if needed). That will force profiling and you'll see the "This script has been profiled" always the param is used.
4) Go to any index.php or view.php page and add the "DONTPROFILEME" to the URL (don't forget the & if needed). Reload 10-20 times and verify that the page isn't ever profiled (looking to footer).
5) Go to config.php and delete/comment this line (because next steps do not work with early profiling enabled):
$CFG->earlyprofilingenabled = true;
|
6) To any URL add the "PROFILEALL" param (don't forget the & if needed). From that moment ALL the pages you visit will be profiled. All.
7) To any URL add the "PROFILEALLSTOP". All the pages won't be profiled anymore (only the 20% random profiling tested in 2) will continue happening).
8) Go to admin -> development -> profiling runs.
9) There you will see a bunch of profiled scripts (from the previous tests). They are sorted by URL.
10) Click on the date of any of them and then "View profiling details". You should get a new window/tab with the xhprof report.
11) Verify it works by navigating, sorting, searching for some function...
12) Don't forget to verify the graph works ([View Full Callgraph] link). This step requires "dot" to be available. By default it shows a png graph. Try adding "&type=svg" to the URL manually. If your browser supports svg, you will get the graph in that format.
13) Go to admin -> development -> profiling runs again.
14) Click on the "arrow" of any script having multiple profiling runs. You will get a page with the runs for that URL only.
15) Pick some of the older runs by clicking on its date.
16) In the page, tick the "Mark as reference run/comment" and set it's name as "base testing run". Save changes.
17) In the breadcrumb, click the rightmost url, you will be back to the list of profiling runs for that url (same than 14) above).
18) Verify that the run you have edited is shown in bold and with comment "base testing run".
19) Click on any newer run. Now you should see 2 options: "View profiling details" and "View profiling differences with last reference run". Click the later.
20) You get a new page with the summary of differences between the 2 runs, the "base" on the left, the newer on the right, with some green/red differences.
21) Click the "View profiling diff details". You should get a new window/tab with the xhprof report showing all the diffs for each function.
22) Verify it works by navigating, sorting, searching for some function...
23) You can try the "View improvements/regressions callgraph", but be noted it's huge and complex to be generated and a timeout may happen. Don't fail this because of that.
24) 2 dozens of testing points to verify it works, thanks!