Modify Common Parameters in Multiple Scripts Using Additional Attributes

Problem statement: Your performance regression scenario contains 20 different Loadrunner scripts. You run this scenario a number of times in a given release.For simplicity, let’s assume that all scripts are developed using web services protocol. There may or may not be any changes to the scripts but version of the service endpoint changes a lot of times. For example, from version R200 to version R300

From http://ServerName:Port/R200/CustomerDataManagement.svc
To http://ServerName:Port/R300/CustomerDataManagement.svc

How to modify all the endpoints to have latest version, possibly without opening the scripts?

Solution 1: One trivial solution which would come to everyone’s mind is to create a parameter, say pEndpointVersion, and use that in the URL as shown below


Drawback: You will have to update the parameter value every time the endpoint version changes. Thus, you will have to download, open and update the parameter in all the scripts. This activity is very time consuming especially when it comes to VUGEN 11.52 as we all know how slow it is for opening scripts. Have a look a solution 2.

Solution 2 (preferred): In your script, go to RunTime Settings(RTS) under ‘Additional Attributes’, add a new argument name and a argument value. For example: argument name ‘EndpointVersion’ with argument value ‘R300’.

RTS-Additional Attributes Option

Then use the statement lr_get_attrib_string(“<Argument Name>“) to retrieve the argument value. In our example, use lr_get_attrib_string(“EndpointVersion“) to retrieve the value ‘R300’.

You can output the value like this

lr_output_message("*******version: %s"lr_eval_string(lr_get_attrib_string("EndpointVersion")));

OR save it into a parameter via lr_save_string() and access it anywhere in the script using the parameter name. For example,


The endpoint will look like http://ServerName:Port/{rVersion}/CustomerDataManagement.svc

lr_output_message("*******version: %s"lr_eval_string(lr_get_attrib_string("EndpointVersion")));

Action.c(25): *******version: R300
Action.c(27): Notify: Saving Parameter “rVersion = R300”.

Benefit: If the endpoint version changes, you can modify the RunTime Settings (RTS) for all the scripts in the scenario in Performance Center itself. You don’t need to open and update it in individual scripts. If all the scripts use same RTS, then it’s even easier. Just modify RTS of one script and duplicate the RTS to rest of the scripts. Following screenshot shows the location of ‘Duplicate Runtime Settings’ option in Performance Center.

Duplicate RTS

In Truclient protocol script, the function is LR.getLRAttr(“<attrib_name>”);

Refer for details: VUGEN help > VuGen > Protocols > Ajax TruClient Protocol > Enhancing Ajax TruClient Scripts > Ajax TruClient Functions

Hope it helps to someone!


2 thoughts on “Modify Common Parameters in Multiple Scripts Using Additional Attributes

  1. This is an awesome explanation, It is so useful when we run more scripts on different environments.
    Thank you.

    I do have a quick question is that can we do this in Load Controller? as i have gone thru your posting it looks like can be done in performance center.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s