Creating Custom Metric Graphs with HP Loadrunner

This post will describe how to create your own custom metric graphs in HP Loadrunner. Using the Analysis tool you can view the standard metrics of a Load Test. But you can also use the VuGen scripts to report your own numbers as ‘User Data Points’ and feed them into the Analysis component.

Let’s assume you would like to report data contained within HTTP responses. E.g. Reporting the number of offered products displayed on a search result page.

This is how you woud go about achieving this:

int count;
// retrieve the number of available products displayed on the result page <a href="">fast and easy payday loans</a>:
web_reg_find("Text=product_id=", "SaveCount=productsCount",LAST);


count = atoi(lr_eval_string("{productsCount}"));
// report the metric as user data points:
lr_user_data_point("Number of products", (double) count);

This is how User Data Points are made available as a live graph on the Performance Center user inteface:

User Data Points displayed during the test execution on the Performance Center UI

… and this is how it is rendered in the Analysis tool:

User Data Points displayed in Analysis

This is an extremely powerful and useful tool when used in the right circumstances.

Leave a Reply

Your email address will not be published. Required fields are marked *