How to select a random parameter captured using

web_reg_save_param("varParamName",
                   "LB=value=\"",
                   "RB=\"",
                   "Ord=All",
                   LAST);
有帮助吗?

解决方案

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

其他提示

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top