On a recent assignment, I was tasked with updating and maintaining five scripts each for three applications across three environments (5 * 3 * 3 = 45). Additionally, each of these environments was scheduled to receive a three-phase upgrade. Each phase would require re-scripting of one group of scripts or another. As you can imagine, my head began to spin as I calculated how many scripts would need updating and how often. I immediately devised a plan to reduce my work load.

Parameterized URLs

First on my “to do list” was to parameterize the URLs in all scripts. It is a simple step that I recommend as a best practice in most cases. URLs change. By parameterizing the URL, you limit maintenance work. In this case though, simply parameterizing the URL still left me updating two parameters in 15 scripts every time an environment changed.

kristy blog 1

Parameterize Transaction Names

While parameterizing the environment and URLs, I discovered that the transaction names included the environment. For this reason, I also parameterized the transaction names.

kristy blog 2

Additional Attributes

Fortunately, HP VuGen has a run-time setting, “Additional Attributes.” The Additional Attributes can be set using The Command Line in HP LoadRunner or HP Performance Center scenarios. In this way, scripts do not need to be updated individually.

Don’t forget to assign the Additional Attributes to parameters in the vuser-init action.

kristy blog 3

Step by Step
Below are the steps I took along with screen shots to use as examples.

1. Define Additional Attributes

kristy blog 4

2. Assign the Attributes to parameters.

kristy blog 5

3. Parameterize all instances of Environment and URL.

kristy blog 6

kristy blog 7

4. Set the Command Line in the scenario (the attributes in the Command Line supersede the attributes set in the run-time settings).

kristy blog 8

By using Additional Attributes instead of a parameter, I was able to set the environment and URL at the Scenario level. This allowed me to change 30 parameters in one place. Thanks to Additional Attributes and the Command Line scenario setting, I was able to reduce my work load by more than 200%.


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.