Well, how to determine the current iteration number?
- The first way is to use LoadRunner parameter od 'Iteration Number' type.
It is described here
- 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 :)
- How to get LoadRunner iteration number - using LoadRunner parameter?
- How to organize user-defined functions into LoadRunner library?
- All LoadRunner visual tutorials