Highlighted
Established Member..
Established Member..
1762 views

Parameterize Vugen Script to work for 2 different URLs

Hi, 

I have a Vugen script that needs to run for 2 different URLs at different times. Those 2 URLs are basically different environments. I want to parameterize the environment with those URLs. I am planning to do it the data file giving 2 URLs and give the variable name in the script, but I would like to know if there is any better logic to it or the code. 

Thanks, 

0 Likes
4 Replies
Highlighted
Honored Contributor.
Honored Contributor.

Re: Parameterize Vugen Script to work for 2 different URLs

The simplest way to parameterize host names during recording. Can be done as described here: http://lrhelp.saas.hpe.com/en/12.53/help/WebHelp/Content/VuGen/UI/118450_ui_rec_opts_http_adv.htm (see: "parameterize server names").

If your script is already recorded then just parameterize the URL/server name and when VuGen asks you if you want to replace all string occurrences, say yes.
Igor Markov
R&D Manager, Performance Engineering Core
0 Likes
Highlighted
Established Member..
Established Member..

Re: Parameterize Vugen Script to work for 2 different URLs

Hi Igor, 

Thanks for the reply. My script is already recorded for one URL. I want to accomodate one more URL to the same script, so I don't have to maintain two scripts. I would need to switch my scripts between those two URLs back and forth for testing. What's the best way to do this? Here is the sample URl that is currently being used. 

"URL=https://xxxxbx.xxxxx-usa.com/app/", 

URL to include= "https://xxxxxlt.xxxxx-usa.com/app/"

0 Likes
Highlighted
Respected Contributor.. Respected Contributor..
Respected Contributor..

Re: Parameterize Vugen Script to work for 2 different URLs

Hello,

Just create a parameter holding the 2 urls, then replace the hardocded url in the script with the parameter's name (surounded by curly braces). If the parameter name you created is "URL", then this is how it looks like:

before:

"URL=https://xxxxbx.xxxxx-usa.com/app/", 

after:

"URL={URL}",

 

Regards,

Hristo

0 Likes
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: Parameterize Vugen Script to work for 2 different URLs

After doing as above, standard paramterization, I like to use adittional parameters to stear which URL a script should use. Or even better the group_name, but that will make the code longer.
Something like this in vuser_init:

	if (!stricmp(lr_get_attrib_string("Group"),"EU")){
		lr_save_string("https://someEU.url.com","url");
	} else if(!stricmp(lr_get_attrib_string("Group"),"NA")){
		lr_save_string("https://someNA.url.com","url");
	}

br /ola

.
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.