Question

How to select a random parameter captured using

web_reg_save_param("varParamName",
                   "LB=value=\"",
                   "RB=\"",
                   "Ord=All",
                   LAST);
Était-ce utile?

La 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}" ) 
);

Autres conseils

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.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top