Mobile usage is sky rocketing across the globe. It is important to test the performance and compatibility of mobile websites. There are many commercial and open source tools and solutions available in the market like HP Mobile Testing Solution, Neoload, Apache JMeter etc. In this post, we will about compatibility testing using HP LoadRunner.
In this tutorial we will discuss about one case study by considering search engine Google and banking website HDFC. In this case study on compatibility performance testing, I have used HP LoadRunner 11.
Compatibility Performance Testing on Google
In this case study, I haven’t actually loaded virtual users (VUsers).Please do not load test any live applications when you explore this case study at your desktop.
Compatibility performance testing across devices and browsers can be easily achieved by modifying user agent string in HP LoadRunner or any other tool.
First step is to record your action in HP LoadRunner. Before you execute the script, gather the user strings for Chrome and iPhone 4S by simple Google search.
• Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1309.0 Safari/537.17
iPhone 4S i.e. iOS 5
• Mozilla/5.0 (iPhone; CPU iPhone OS 5_0_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Mobile/9A405
How to modify user agent string in HP LoadRunner?
Navigate to Vuser > Run-Time settings or simply press F4 key
In Run-Time settings dialog box, click on Browser Emulation. In Browser Emulation options (i.e. right side), click on Change button as shown below figure.
By default, User-Agent dialog box will display your user agent string as shown below. To overwrite, just copy the user agent here and click on OK. In Playback, LoadRunner overwrites the default user agent string with the new one in all the requests.
But our aim is to compatibility performance testing in multiple browsers and devices. To achieve our objective, we need to parameterize the user agent strings.
How to parameterize user agent string in HP LoadRunner?
Press CTRL + L or navigate to Vuser > Parameter List to create parameter.
Parameter List dialog box opens up. Click on New button as shown below.
Type “UserAgentString” as shown below and press ENTER key.
Click on Create Table to create a UserAgentString.dat file as shown below.
Click on Edit with Notepad… and enter the user agent strings. Save it and close the notepad.
If you get any error, make sure you set below settings Column delimited must be Tab in Parameter List dialog box. Click on close one you are done.
Go to the top of your script, and enter below snippet.
web_add_header function has two parameters, one is to mention the type of header and another one is for header value / content.
Before you execute the script, increase the iterations to 2 under Run Logic.
Below are the snapshots of Google in Chrome and iPhone 4S.
Compatibility Performance Testing on HDFC
If users accessing HDFC site from desktop, URL of the HDFC is http://www.hdfc.com , but if the user access HDFC from his mobile, URL of the HDFC will be http://m.hdfc.com which means HDFC identifies the agent and redirects accordingly. Now we will analyze whether HP LoadRunner doing its job correctly.
When we simulate requests from iPhone to HDFC servers via LoadRunner, LoadRunner should redirect the requests to m.hdfc.com
Record your actions on HDFC in LoadRunner and parameterize the user agent string as shown above. Below is the observations made during the execution.
- First request is for Chrome which processed correctly. LoadRunner displayed how HDFC site will look in Chrome browser. See below figure.
- Second request is from iPhone 4S, so LoadRunner redirected to m.hdfc.com and displayed as it is. Below are the replayed log and the snapshot.
Action.c(3): web_add_header(“User-Agent”) was successful [MsgId: MMSG-26392]
Action.c(5): Redirecting “https://www.hdfc.com/” (redirection depth is 0) [MsgId: MMSG-26694]
Action.c(5): To location “http://m.hdfc.com” [MsgId: MMSG-26693]
Action.c(5): web_url(“www.hdfc.com”) was successful, 50470 body bytes, 10819 header bytes, 11 chunking overhead bytes [MsgId: MMSG-26385]
Compatibility performance testing can be easily achieved by changing the user agent string. User agent string is one of the factors in compatibility performance testing. Few other factors are Bandwidth, Latency, Network simulation can be achieved only thru complete mobile testing solutions like HP Mobile Testing Solution, NeoLoad etc.
LoadRunner just helps to validate the compatibility and performance of the web applications in case we do not have complete testing tool.
I hope this article explained how to achieve compatibility performance testing using HP LoadRunner.
Thanks for visiting QAInsights!
We’re always posting interesting articles on QAInsights. I request you to subscribe so you don’t miss out anything.