lr_paramarr_random Function in LoadRunner with Examples

There are are many situations in LoadRunner where function returns set of values. Let us consider example of correlation. Correlation uses function Web_Reg_save_Param function which sometimes returns list of values that we may say that it returns array  of values. Suppose this function returns four values. We may want to use first , we may want to use second value, third value or fouth value or maybe any value which is picked randomly. Some of the things can be handled by this function only itself f but what if we want to select value randomly. So there are group of functions available in LoadRunner which makes this task easier.

It will be easier to understand it with the help of an example. Let us see the example given below.

int arrSize;

char * FlightVal;

web_reg_save_param(“outFlightVal”, “LB=outboundFlight value=”, “RB=>”,  “ORD=ALL”,  “SaveLen=18”,  LAST );

Let us suppose that the function given above returns four values, which are given as below.

Notify: Saving Parameter “outFlightVal_1 = 230;378;11/20/2003”

Notify: Saving Parameter “outFlightVal_2 = 231;337;11/20/2003”

Notify: Saving Parameter “outFlightVal_3 = 232;357;11/20/2003”

Notify: Saving Parameter “outFlightVal_4 = 233;309;11/20/2003”

Notify: Saving Parameter “outFlightVal_count = 4”

Now we can clearly see that above function returns four values. Now there are functions available in LoadRunner from which we can retrieve any value from the set of values. Let us see how we can use these this functions.

FlightVal = lr_paramarr_random(“outFlightVal”);

This function lr_ paramarr_random is used to retrieve value from any random index of the array. This will retrieve value from any randon index of the array and will store this value in FlightVal . We cannot determine the index number and which index value will be selected from this array list . It could be any index from the array ranging from 0 to 3. It is also very beneficial in certain scenarios. It is specially used in the scenario where we want random value selected from the ArrayList.

Overall, we can say that it is very important function which is used in LoadRunner , especially in the scenario when we have to select random value from the arraylist. We have to use this function wisely to get productive result while doing performance testing using LoadRunner tool.

For More read our Loadrunner Functions with Examples

Leave a Comment