How to automatically create custom HTML report in LoadRunner Analysis from command line?

How to automatically create custom HTML report in LoadRunner Analysis from command line?

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:
  1. restarts test server
  2. configures and starts services of my application to be tested
  3. starts LoadRunner tests
  4. performs load testing
  5. gathers and analyses results from automated tests
  6. creates custom reports
  7. attaches these reports to email and send to appropriate addressees
  8. repeats the above actions for next automated LoadRunner test
I plan to share this framework in the nearest future, if anyone asks it :)

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.
So, prepared "Save As Template" dialog is shown on the screen shot:
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:
  • 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
There is an example for my template ("WinResTemplate"):
"c:\Program Files\Mercury\LoadRunner\bin\AnalysisUI.exe" -RESULTPATH C:\Temp\30users\30users.lrr -TEMPLATENAME WinResTemplate

Tips on the example:

  1. Since path to AnalysisUI.exe contains spaces, use quotes (")
  2. You have to specify name of template, not path!

That's all!
Execute the example command from command line.
You will see that:
  1. Analysis will be loaded
  2. It will start processing lrr-file, which was produced by LoadRunner Controller.
  3. After it precesses lrr-file, Analysis will apply template. That means, needed graphs only will be created. We have specified these graphs above.
  4. Analysis will create HTML report
  5. HTML report will be saved in specified path (I used - %ResultDir%\Windows_Resources_Report.html)
  6. 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 :)


Suresh chowdary said...

HI dimitry,

Nice one on how to avoid repetetive tasks in testing ..

and could you please explain more aon analysis part which is more diffcult to most of beginners and midlevel performance testers ..

types of anaylsys parts in lr ..

how to get into analysis from the beginning after ececution .

like these which ever you feel useful to perf testers .

thanks ,

suresh chowdary

sri said...

Hi Dimitry

Thank you for the valuable information.

Could you please let share the procedure of the framework which you mentioned.

"I plan to share this framework in the nearest future, if anyone asks it"
Thank you once again

ajay said...

HI Good work thaks for your effort could plz explain sending report to email which you have mentioned
"I plan to share this framework in the nearest future, if anyone asks it"

Ashish Shiraj said...

Hi Dimitry,

This Post helped me in automating the creation of LR Test report. Thanks.

Please Share Your Framework to Us..It would be a great help.

Also, I wanted the Report to be in XML, so that I can parse the data points in order to calculate Average Transactions(Pass) per second from a Linux Controller, (I use STAF as wrapper to these commands in Windows) As I have to create a single Report from Multiple Test Runs.

Any Other way to get the data written in HTLM report in some variables or in a file?

Thanks Again ..

Maradana said...


Good Post Can u please sharethe frame work with us so that it will be helpful for all of us

Vamsi Kalyan

Amit Bhagwat said...

Hi Dimitry

Actually you may skip this comment(Not approve it :-)as it is nowhere related to the above article.

Anyways this is just to thank you for all Loadrunner/QTP knowledge you have unleashed for not so intelligent but definately hardworking people like me!!!!... We get to learn many things from you. Please continue this noble cause:-)...

Kind Regards

Amit Bhagwat

Divesh Khanduja said...

Hi Dimitry,

This Post helped me in automating the creation of LR Test report. Thanks
Divesh Khanduja

Jeff Wu said...

Hi Dimitry, this info is very useful! Thanks!

Do you know where I can find the supported CLI of AyalysisUI.exe? I can't find from HP or Google search. We want to add some global filter for elapsed time. Thanks in advance!


Dmitry Motevich said...

I don't know others command line interfaces of AnalysisUI.

You can create custom template and defined there all required filters. Using above article, you can automate your task.

P.S. My name is Dmitry, not Dimitry.

Jeff Wu said...

Hi Dmitry, thanks a lot and sorry for my typo. :)

I will try out with custom template.


Dmitry Motevich said...

Dear Readers!
Thank you very much for you comments!

Since this article was published more than one year ago, I've just disabled an adding of new comments for the article.