Introductory words about LoadRunner Analysis HTML reports:
I like watching on how my LoadRunner scripts work without my intervention. The plan is simple:
- I start LoadRunner Controller from command line
- Controller performs load testing
- After Controller finishes, it opens Analysis
- LoadRunner Analysis analyses :) and interprets results of load tests
- I create and export customized HTML report
Default HTML report looks like the following one:

The task I faced:
After Analysis completed working, custom HTML report should be created and exported automatically and be sent with email. After that, next load test can be started from bat-file. So, there are no any pauses for tester's intervention should be.
My custom HTML report should contain new graph - "Windows Resources". Also, several default pages should be removed - "Running Vusers", "Throughput", and "Transaction Summary". So, new HTML report should look like:

And the main condition is:
- this custom report should be generated automatically every time I started my production LoadRunner scripts
How I created custom reports before:
Actually, any custom report can be created manually... I added manually new graph ("Windows Resources"), deleted unnecessary pages, generated HTML report, saved it, attached to email and sent it.
Why I had to automate the creation of reports:
Above process requires tester's time (= mine). I'm lazy man and don't like wasting my time for such routine actions.
Another important reason to generate these custom reports automatically is that I created something like a framework, which:
- restarts test server
- configures and starts services of my application to be tested
- starts LoadRunner tests
- performs load testing
- gathers and analyses results from automated tests
- creates custom reports
- attaches these reports to email and send to appropriate addressees
- repeats the above actions for next automated LoadRunner test
Well, let's start working on the current topic...
I will show how to edit a default report and save it as a template. After that, we will learn how to start LR Analisys from command line and how to work with a saved template.
How to create custom report:
I recommend to customize a default report and save it as a template.
To delete "Running Vusers", "Throughput", and "Transaction Summary" pages, select them in Session Explorer, right-click and select "Delete Item":

The new graph ("Windows Resources") adding is also intuitive. Just right-click on "Graphs" item and select "Add New Item / Add New Graph":

After that you can select new graph to added. In my case, I selected "Windows Resources" graph:
Note: if you want to add "Windows Resources" graph, it must be added to LR Controller. Please, read my previous post to see how add and process "Windows Resources" graph:How to detect memory leaks with LoadRunner - visual tutorial
After that I rearrange the current list of graphs. For that just drag any item (graph) and drop it to required place. It's easy, really :)
After these manipulations, the list will be the same I wished:

Great! The finish is not far :)
Now I select menu "Reports / HTML Reprot..." and get the report I dreamt :)

The next step is saving of the current report as a template:
Select menu item "Tools / Templates / Save As Template...".
As a result, "Save As Template" dlg will be shown:
I perform the following:- Uncheck "Automatically apply this template to a new session" checkbox.
This will allow to load default template when I start LoadRunner Analysis. Unchecked option suits me. - Check "Generate the following automatic HTML report" checkbox.
If checked, the HTML report will be generated automatically. This is what I need. - Check "Automatically save the session as" checkbox.
It should be checked to correctly automatically close Analysis. - Check "Automatically close Analysis after saving session" checkbox.
I recommend to enable this option. It will be irreplaceable, if you plan a batch processing - that's our case.
Click OK btn to save new template.Close LoadRunner Analysis. Now we are ready to perform last action.
Start LoadRunner Analysis from command line:
- To start only Analysys, execute the following command:
path_to_AnalysisUI.exe - To open *.lrr file (LoadRunner result file) or *.lra file (LoadRunner Analysis file), execute:
path_to_AnalysisUI.exe-RESULTPATH path_to_lrr_or_lra_file - To open *.lrr or *.lra file and apply a specified template, execute:
path_to_AnalysisUI.exe -RESULTPATH path_to_lrr_or_lra_file-TEMPLATENAME name_of_template
"c:\Program Files\Mercury\LoadRunner\bin\AnalysisUI.exe" -RESULTPATH C:\Temp\30users\30users.lrr -TEMPLATENAME WinResTemplate
Tips on the example:
- Since path to AnalysisUI.exe contains spaces, use quotes (")
- You have to specify name of template, not path!
That's all! Execute the example command from command line.
You will see that:
- Analysis will be loaded
- It will start processing lrr-file, which was produced by LoadRunner Controller.
- After it precesses lrr-file, Analysis will apply template. That means, needed graphs only will be created. We have specified these graphs above.
- Analysis will create HTML report
- HTML report will be saved in specified path (I used - %ResultDir%\Windows_Resources_Report.html)
- At the end, Analysis will be closed.
So, custom HTML report is ready without tester's intervention! Next LoadRunner test can be started from command line.
--
Dmitry Motevich,
living in LoadRunner-city :)