VuGen: More Random Selections

/*
The following lines will capture a list returned from a web server page response and
then randomly select one of the items from that list and pass it on
to the next URL
*/
 
int rNum;
char x[500];
 
web_reg_save_param("temp_cat",
"LB=abcdef",
"RB=xyz",
"Ord=ALL",
LAST);
 
web_url("index.jsp",
"Some URL's",
LAST);
 
//srand is called before rand
 
srand(time(NULL));
 
rNum= rand() % atoi(lr_eval_string("{temp_cat_count}")) + 1;
 
lr_output_message ("A number between 1 and temp_cat_count: %d\n", rNum);
 
/* rNum will be some random number between 1 and temp_cat_count */
 
sprintf(x,"URL=http://www.XYZ.com/site/olspage.jsp?{temp_cat_%d}&type=category",rNum);

What's Next?

Did you enjoy this article? Help spread the word by sharing:

Join the Northway Navigator Club today and get access to restricted content including our best tips and tricks. Membership is free! You will also receive free email updates by registering.

Engage in the conversation and leave a comment:

Scott Moore

About Scott Moore (153 articles)

With over 20 years of IT experience with various platforms and technologies, Scott has tested some of the largest applications and infrastructures in the world. He is a Certified Instructor and Certified Product Consultant in HP’s LoadRunner and Performance Center products. He currently holds HP certifications for ASE, ASC, and CI. A thought leader in the APM space, he speaks regularly at IT conferences and events