LoadRunner has many unique features to emulate a real-world scenario in performance testing. And, the only purpose is to provide a correct and accurate test result. A simple and best example is ‘Vuser’ or ‘Virtual User’. It is named virtual but it imitates a real user behaviour. To continue with the emulation behaviour of the LoadRunner, this article covers another key feature that helps to emulate the real browser for a virtual user (Vuser) and the feature is called “Browser Emulation”. Again, one point to recall here is that LoadRunner does not have a real browser to send the request to the server. It acts as a real browser by emulating the features of the real-world browser which gives a feel to the server that the request is coming from a real browser; not from a tool.
When a browser sends a request to a server a user-agent string is embedded in the request which is identified by the server.
Example of User String:
User-Agent Strings: Mozilla/4.0 (compatible; MSIE 7.0; Windows; en-us)
The identifying details in the user-agent string are (refer to the above example):
- Browser Name: Mozilla
- Browser Version: 4.0
- Operating system: Windows
- Language: en-us
The ‘Browser Emulation’ setting is available in the Runtime Settings of LoadRunner. You can find this setting in the ‘Browser’ category and update the inputs as per the requirement. Refer to the below figure:
What are the settings available for Browser Emulation in LoadRunner?
There are two settings available for browser emulation:
- User-Agent Selection
- Browser Cache
1. User-Agent Selection: This setting is used either to create a custom user agent string or to use a default user agent string. As mentioned above the user agent string has 4 options, no matter whether it is custom or default. Choose the appropriate option as per your requirements. If you want to create a custom user string then you need to choose the value from the drop-down list for Browser Type, Browser Version, Platform (Operating System) and Language. The user agent string will be created automatically based on the inputs selected by you.
a. Custom User-Agent String:
b. Default User-Agent String:
2. Browser Cache: This option emulates the cache setting of a real browser.
- Simulate browser cache: It instructs the Vuser to simulate a browser with the cache. On disabling this option, the resources like images, frames etc. will be downloaded once for each page.
- Cache URLs requiring content (HTMLs): To parse, verify and correlate specific HTML content. Once you enable ‘Specify URLs requiring content in addition to HTML page’ then the URL must be defined in the ‘Content Types’ field.
- Download non-HTML resources: Enable graphic image loading on the page. This will keep Vuser in waiting until all the non-HTML resources on the page are downloaded.
- Simulate a new user on each iteration: This option forces a new user to begin a new browsing session.
- Clear cache on each iteration: It flushes all the stored cache of the previous iteration.
- Simulate prefetch and prerender: It helps to simulate prefetch and prerender tags in HTML5 for a Vuser.
- Use Default: On clicking the ‘Use defaults’ button, VuGen resets the browser emulation settings and enables all the default options.