Question

How to select a random parameter captured using

web_reg_save_param("varParamName",
                   "LB=value=\"",
                   "RB=\"",
                   "Ord=All",
                   LAST);
Was it helpful?

Solution

Your LB and RB conditions are too generic. Pick something more specific to what you are trying to capture

To your greater question, there are several paths on picking an ordinal depending upon your version of LoadRunner. Something which works for every version would be

char foo[50];
...
sprintf(
     foo,
     "{varParamName_%d}",
     rand() * atoi( lr_eval_string("{varParamName_count}" ) ) +1
);
...
lr_save_string(
     lr_eval_string( foo ), 
     "LR_MyRandomCorrelatedvariable"
);
    ...
lr_output_message(
     "%s", 
     lr_eval_string( "{LR_MyRandomCorrelatedvariable}" ) 
);

OTHER TIPS

to randomize the correlation values we can use lr_paramarr_random function.

web_reg_save_param("varParamName","LB=value=\"","RB=\"","Ord=All",LAST);

// some request ***web_submit_form()

//Save a randomly selected ID to a Parameter lr_save_string(lr_paramarr_random("varParamName"),"RandomParam");

now we can use RandomParam instead of varParamName. it will provide random values.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top