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.
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.
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.
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.
Step by Step
Below are the steps I took along with screen shots to use as examples.
1. Define Additional Attributes
2. Assign the Attributes to parameters.
3. Parameterize all instances of Environment and URL.
4. Set the Command Line in the scenario (the attributes in the Command Line supersede the attributes set in the run-time settings).
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
You must be logged in to post a comment.