Vugen: Simulate Various Browser Behaviors
Posted on Jul, 2012 by Admin
Let’s discuss the various Browser Emulation settings in Vugen’s Run-Time Settings.
The “Simulate browser cache” option tells LoadRunner to “pretend” that it has a cache stored in the current session, and to keep track of the resources it has already downloaded. If a resource is in the cache and it is requested again by a new step in the Vugen script, it will not request this resource again from the server for that session. This is how a browser would typically behave unless the user has altered the browser cache settings.
The “Simulate a new user each iteration” option instructs Vugen when to clear the cache. If this option is checked, LoadRunner will pretend that each iteration is a new user, and will create a new cache from the start. If the option is not checked, then the cache is kept between iterations. For most load tests, this works. You might change if you are trying to simulate a specific profile of returning users who do repetitive tasks throughout the day.
“Clear cache on each iteration”, when selected, clears the browser cache for each iteration in order to simulate a user visiting a Web page for the first time. Clear the check box to disable this option and allow Vusers to use the information stored in the browser’s cache, simulating a user who recently visited the page.
Let’s discuss some of the combinations of options available for Browser Emulation settings:
- With “Simulate browser cache” selected and “Simulate a new user each iteration” unselected, Vugen will not download resources on from the second iteration onwards if it is already considered to be stored in the cache. If the web_cache_cleanup function is used in the script, it will override these run-time settings, meaning it will clear the cache when the function is called as if the “Simulate a new user” WAS checked.
- With “Simulate browser cache” checked AND “Simulate a new user each iteration” selected, Vugen will reload the resources each iteration, but only load them once per iteration if they are considered to be stored in the cache.
- Cache URLs requiring content (HTML), when selected, instructs VuGen to cache only the URLs that require the HTML content. The content may be necessary for parsing, verification, or correlation. When you select this option, HTML content is automatically cached. You can decrease the memory footprint of each Vuser by deselecting this option if you do not need it.
- Check for newer versions of stored pages every visit to the page, when selected, instructs the browser to check for later versions of the specified URL than those stored in the cache. When enabled, VuGen adds the “If-modified-since” attribute to the HTTP header. This option brings up the most recent version of the page, but also generates more traffic during the scenario or session execution.
It is important to know what these options do and how they affect they way Vusers will react to the web server and how it will affect traffic patterns. You may actually have situations where you need to run an iteration with various combinations and look at the web server logs to prove to a developer that it is doing what the settings claim. Sometimes developers do not believe that LoadRunner has this kind of flexibility to emulate various kind of browser settings and behaviors and must be put in their place, so make sure you are sure of what these settings do.