What are LoadRunner parameter and parameterization?

What are LoadRunner parameter and parameterization?

This is a simple question - what is LoadRunner parameter?

I've reread LoadRunner VuGen User's Guide v9, trying to find the exact definition of LoadRunner parameter. That's strange, but LoadRunner Help does not contain the exact answer on this question.

In this article, I will answer basic questions, connected to LoadRunner parameters.
I think, LR beginners should study this article carefully :)

So, I recommend to read it, if you want to know:
  • the definition of LoadRunner parameter
  • LoadRunner parameter functions
  • how to create parameter in LoadRunner VuGen script
  • which types of LoadRunner parameter are available
  • how LoadRunner processes parameters - gets and sets their values
  • other key concepts, connected to LR parameters
OK, let's start.

I've recorded Web (HTTP/HTML) simple script on Web Tours demo web application. There are two first steps:

Please, notice that we use the following hard-coded username & password - jojo and jojo:
  1. "Name=username", "Value=jojo", ENDITEM,
  2. "Name=password", "Value=bean", ENDITEM,
They are hard-coded in the script! This is important.

What should we do, if we want to execute our script sequentially for different users, for example for jojo/bean, then for bob/lcdm, dm/psswrd, and so on?

There are several solutions:
  • The simplest one is to record our script for each user.
    In this case, our pseudocode will look like:
  1. Login as jojo/bean
  2. Perform other actions under jojo/bean

  3. Login as bob/lcdm
  4. Perform other actions under bob/lcdm

  5. Login as dm/psswrd
  6. Perform other actions under dm/psswrd

  7. so on...
As you can see, our code is duplicated. Actually, this is not good idea (read this article to find out why it is).
  • We can remake our code:
  1. Loop - perform next actions for each user name and password
  2.     Read user name and password into {UserName} and {Password} variables
  3.     Login as {UserName} and {Password}
  4.     Perform other actions under {UserName} and {Password}
So, what have I done?
I do not use hard-coded values (jojo/bean, bob/lcdm, dm/psswrd, and so on). Instead, we use special variables - {UserName} and {Password}. They are parameters.
The source code will look like:
So, now we can answer:

Question: What is LoadRunner parameter?

The simple answer is:
LoadRunner parameter is a
special variable.
Note: We will investigate parameters and I will provide more exact definition later.

Since LoadRunner parameter is a variable, then I compare it with standard stack-based variable from C language (for example - int i).

  • Declaration
    To declare stack variable you can just write:

    1. int i;

    This means, that name of variable is 'i', and its type is int. It's easy, isn't it?

    To declare LoadRunner parameter you have to:
    1. select string, to be replaced with a parameter
    2. right-click on the selected text
    3. 'Replace with a parameter'
      'Select or Create Parameter' dialog opens.

    4. Here, you can enter name of your parameter:
      Note, that you can see an original value as well ('jojo' in our case).

    5. Specify type of parameter
      Parameter type is determined by the source of parameter data:
      Once you specified name and type of parameter, you declared LoadRunner parameter.

      The above declaration of parameter uses GUI ('Select or Create Parameter' dialog).
      This is not the only approach. We can declare parameter and assign value with lr_save_ functions (lr_save_string, lr_save_int, lr_save_searched_string, lr_save_var, and lr_save_datetime).

      See these examples:
    1. lr_save_string function

      1. lr_save_string("abCDEfgID", "prmProductID");
      2. lr_output_message("ID is: %s", lr_eval_string("{prmProductID}"));

      Here, I define new parameter ("prmProductID") and assign a value ("abCDEfgID") to it. So, the parameter contains this value.
      To make sure that the parameter contains correct value, please see the result of execution:

      Please, note that we can write analogous code using a stack variable:

      1. char *pszProductID = "abCDEfgID";
      2. lr_output_message("ID is: %s", pszProductID);

      The result will be the same:
      So, as you see, LR parameter is similar to standard variables.

    2. lr_save_int function

      1. lr_save_int(144, "prmCounter");
      2. lr_output_message("Counter: %s", lr_eval_string("{prmCounter}"));

      3. lr_save_int(-18, "prmCounter");

      Result is:

      Again, we can write analogous code using stack variables:

      1. int i;
      2. char pszCounter[12];

      3. i = 144;
      4. itoa(i, pszCounter, 10);
      5. lr_output_message("Counter: %s", pszCounter);

      6. i = -18;
      7. itoa(i, pszCounter, 10);
      8. lr_output_message("Counter: %s", pszCounter);

      The result will be the same too:

I think, you've received evidence, that LR parameter is similar to a variable. So,
So, now you can ask:

Question: What's the difference between LR parameter and stack-based variables?
// That is the question (C) W. Shakespeare :)

OK, I will answer - the LoadRunner parameters simplify:
  • Working with memory
    That is, you don't have to know, how many bytes allocate for a current value of parameter.
    You just use lr_save_string (for example) function, and LR allocates required number automatically.

  • Working with data sources
    For example, you can indicate, that values of parameters will be stored in a file:
    In this case, you don't have to write additional code for file processing. LoadRunner takes all routine procedures upon himself. For example - when and how update values from file, what is the current delimiter, and so on.

    Actually, these features (working with memory and data sources) are very comfortable from user's side. That's why LoadRunner parameter is used so extensively.

My article, describing LoadRunner parameter and parameterization, is up.
I hope, it was helpful :) Please, let me know...

In the next part, I will describe operations you can perform with parameters.
After that, I will explain - how LoadRunner parameterization is connected with correlation (this question was asked by Anonymous in his comment).

And, as usual, I'm waiting for your opinions.
If you have some questions or doubts - feel free to ask me.

Yours faithfully,
Dmitry Motevich, living in LoadRunner-city :)

Related articles:


Anonymous said...

Thanks for the Article. Another tutorial describing the usage of various options available for the Paramters i.e the following will be helpful.

a. Next row selection(sequential,Unique)

b.update method(i.e each iteration,once)


c.Option for When Out of Values( i.e - Continue in Cyclic manner,Abort Vuser,continue with LAST value)

An example of how these will be used when there is only one single user and when there are multiple users will be helpful.

Anonymous said...

Hi Dmitry,

What I want is to paramaterize my script using the parameterization feature of LR but don't want to hard code the location of the dat files.I want the code to be portable. Is there a way to relatively locate a dat file during runtime?

Anonymous said...

Thank you very much. All your tutorials are very useful. Can you post more about how each parameter type(especially the iteration number) is used?

Anonymous said...

Thanks a load.

gr said...

Can you please post an example of using the web_eval_java_script function?

Anonymous said...

Thanks but could u please let me know the purpose of having columns in datafile. IF i have login nad password in same file, how can i use them in my script. explain with eg

sivaramakoteswararao said...

1.what is caching? when will we use caching?

2. How to report the scenario analysis. Give me the brief explanation?

sivaramakoteswararao said...

1.what is caching? when will we use caching?


pranav said...

its a great help for entry level ppl,dude you are the best ,thanx and i really really appreciate the way you like to share your in depth knowloadge
once again thnx buddy

Anonymous said...

Simple and easy to understand! thanks a ton!

Anonymous said...

I found out your blog site today and was going through your articles. They have been beautifully written and explained well. I have been working with automation tools (WR,QTP and LR) since last 4-5 years, but reading your blog made many things easier for me to understand and keep in mind. Thanks and keep sharing the knowledge.

Anonymous said...

Thanks. This is the most practical explanatiion of the loaddrunner i have ever come across. Please keep it up.

Dmitry Motevich said...

Thank for reading my blog!
I will continue posting interesting articles

munu said...

hi thanks for sharing your knowledge in such a nice way.

lucky said...

how can we run script without installing qtp ?

Dmitry Motevich said...

2 lucky:
What scripts do you want to run without QTP? Maybe, JavaScript, Perl scripts or Python scripts? :)
Please, specify...

Kashif Iqbal said...

Hi, Thanks for posting such a good article on oarametrization.
I am facing a little poroblem in parametrization. I am using 2 ranges of numeric strings i.e. Start Range and End Range. I am using both as parameter and data table has values against both of these parameters. I have selected to update values only once and both ranges should be unique in each iteration but when script replay the old values will be retrieved by script. So how can I handle this.
Second thing is that how can I increment in these 2 values ?

Dmitry Motevich said...

2 Kashif:
I didn't understand your problem with dates... Please, explain in details, if possible.
Any examples and screenshots will help me to help you :)

sdip said...

finally i found a place where i can interact effectively, I have been trying for random parameterization within a single iteration ,i tried the use random for each occurance which is doesnt quite well work with what i am doing.. goal is to drive a different values within each iteration. any suggestion is welcome.
thanks for the help in advance.

Dmitry Motevich said...

I cannot understand what you ask.
If you want to get an answer, please, formulate a detail question.

sdip said...

no of Iterations specified in the run time settings is 1(one) ,
In the script i am iterating multiple(4) times(eg:adding 4 locations) ,I want to add a unique location for each iteration .
i tried specifying unique/random for each occurrance , I want to use next row.
I hope this helps. please let me know.thanks

sdip said...

I hope this helps. please let me know.thanks

Dmitry Motevich said...

I cannot answer your question until you specify details...
Please, understand me:
- I know nothing about your application
- I've never seen your LR script
Which "unique location" do you mean?

Anonymous said...


I am trying to create a script that will run forever (3 days). I have a dat file with SSN (social security number) for customers. I have choosen to select a new for each iteration. My problem is that I have serveral user running same script, and i only want to use each ssn once. (not once for each user) With the option each iteration i excepted it to used only once, but since i have 200 users, its been used 200 times. What can i do? Thanks for any answer

Dmitry Motevich said...

As I understood, you have to select
"Use a new value for each occurrence of the parameter" setting of SSN parameter.

Anonymous said...

But i think that is also wrong since the ssn is posted serveral times during once iteration. I need to keep the same customer during the whole script. I understand chosing that option will make it change during the iteration. Maybe i am wrong how it works? Thanks for your answer

Dmitry Motevich said...

2 Mr. Anonymous:
Your requirements are so changeable...

If you "need to keep the same customer during the whole script", then use "Once" option for SSN parameter.

P.S. I would recommend to formulate your question in details... It's so difficult to read them and understand what you want.

Anonymous said...

Thanks again. Sorry for the bad question :-)

Scenario: 200 simulationous users filling out loan applications for idefently many customers.

One loan application for each customer.

The SSN is put in serveral times during one iteration. For one iteration it need to keep the same, but should never be used again for that user or any other user after that iteration is done.

I will try "once" option now. It sounds incorrect but i guess it depend what that they mean with "once"


Anonymous said...

Tried "once" options now and sadly it dont works. It looks like it works like "each iteration", but it will not start at det beginning after i am out of ssn.

After some more testing i found out that the correct option is "each iteration" but you also need to select unique in the drop down over that selection.


Anonymous said...


I have been doing Manual Testing for long,just 1 week back i started studying Load Runner through User Guide and Various sites..I am speechless to appreciate your efforts.............They are absolutely fantastic..........I was yearning for something like this.This is coming directly from my heart....I am really happy ,for a beginner like me it's a boon and u have cleared most of the concepts of scripting and paramterization.Thank u sooo much...
Its like a virtual class and tutorials are also fantastic

...May God Bless U ! :)

Dmitry Motevich said...

Thank you for your words :)

Satish said...

HI Dimitry,

I am having an issue with Parameterization. I have selected in the following way for parameterizing some data: "Unique", "Update on each iteration", "Abort when out of values", "Automatically allocate block size" and there are around 12000 records in .dat file. I have assigned 12 users for this script, and getting error "Insufficient records" during the load test.

Dmitry Motevich said...

I explained this error and its cause here:
LoadRunner VIDEO - Parameters part3 ('Select next row' = 'Unique')

Anonymous said...

Hi, I have a typical requirement. I have three dropdowns on my web based app. The values in second dropdown are dependent on selection in first dropdown and so for the third. I need to select the values in each dropdown sequentially in each iteration. Am not sure how to recognize the dropdowns and select the values. The only step that LR reads is the submit button click after selecting the dropdowns, where it sends the selected values in the url to the server. Can you please help?

Anonymous said...

It is true that there is not particular definition for Parameter, but your example helps a lot. Thanks and GOD bless you.

Dmitry Motevich said...

@Anonymous (December 11, 2008),
It seems, you confuse functional testing (QTP) and load testing (LR).

LoadRunner does not record UI objects. It records a client-server traffic.
I think, you should use QTP for you task

Dmitry Motevich said...

Dear Readers!
Thank you very much for you comments!
