How to get LoadRunner iteration -Using Global variable
How to determine the current iteration number?
The first way is to use LoadRunner parameter od 'Iteration Number' type.
The second way is to use a LoadRunner global variable.
I will explain this approach now. Also, you will see how to define and use global variables.
Define a global variable
You can add a new variable definition into vuser_init section of LoadRunner script:
Then we will add a variable incrementation and usage into Action section of LoadRunner script. For example, like this:
Please, note that LoadRunner does not require using of "extern" keyword.
And last step is to open LoadRunner Run-time Settings and to set the desired total iteration count. In my example I set it to 3:
That's all! Let's start our script and see Log-file:
As you can see, nIterationNumber variable changes its values with every new iteration.
Tip: do not forget to increment its value, for example with ++ operator.
Both proposed approaches (with LoadRunner parameter and with a global variable) are simple enough. Use any you like and track your LoadRunner iterations thoroughly :)
The first way is to use LoadRunner parameter od 'Iteration Number' type.
The second way is to use a LoadRunner global variable.
I will explain this approach now. Also, you will see how to define and use global variables.
Define a global variable
You can add a new variable definition into vuser_init section of LoadRunner script:
Then we will add a variable incrementation and usage into Action section of LoadRunner script. For example, like this:
Please, note that LoadRunner does not require using of "extern" keyword.
And last step is to open LoadRunner Run-time Settings and to set the desired total iteration count. In my example I set it to 3:
That's all! Let's start our script and see Log-file:
As you can see, nIterationNumber variable changes its values with every new iteration.
Tip: do not forget to increment its value, for example with ++ operator.
Both proposed approaches (with LoadRunner parameter and with a global variable) are simple enough. Use any you like and track your LoadRunner iterations thoroughly :)
LoadRunner Training in Bangalore
LoadRunner Training in Hyderabad
LoadRunner Online Training
LoadRunner Training in BTM
LoadRunner Training in Marathahalli
Best LoadRunner Training Institutes in Bangalore
Best LoadRunner Training Institutes in India
Training Institutes in Bangalore
No comments:
Post a Comment