In this blog post, we will discuss about one of the key topics in Software Testing. Usage of mobiles, tablets and other handheld devices are sky rocketing now-a-days. It is vital to validate compatibility, functionality and performance of the devices and it applications (apps).
Role of user agent plays a critical role in testing web and software apps across various platforms.
What is User Agent?
User Agent is an identity of a client (user). A user agent has details about the client such as OS and its version, browser name and its version. Server processes the requests and provides responses for your browser by identifying using User Agent.
User Agent string resides in the header section of each request. Below is the sample header which has a user agent.
GET | http://newtours.demoaut.com/images/nav/html.gif HTTP/1.1
Accept | */*
Accept-Language | en-US
User-Agent | Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0)
Accept-Encoding | gzip, deflate
Host | newtours.demoaut.com
Proxy-Connection | Keep-Alive
ServerSuppliedCookie | osCsid=a6716386791c778c8320a5f5f2a7461a
Please note Microsoft Internet Explorer identifies as a Mozilla for historical reasons. Below is the significance of each parameter in user agent. Pipe symbol ‘|’ is used only to separate the values. It will not be there in the actual request headers.
Mozilla/4.0 | Browser name and its version
Compatible | Compatibility token
MSIE 8.0 | Microsoft Internet Explorer 8.0 identifies as a current browser and its version
Windows NT6.1 | OS version i.e. this is for Windows 7
Trident/4.0 | Version of MSHTML which validates the compatibility view of the webpage.
Following code displays your user agent string:
How user agent useful in testing?
To validate the compatibility and performance of the web applications in various platforms, user agent plays a vital role by sniffing.
How to change user agent in your browser?
If you are a Mozilla user, there is an add-on which switches the user agent of your browser. Download User Agent Switcher
Once you installed, it will adds a menu. See below snapshot.
Get the user agent of iPad from the XML file. User agent of iPad is Mozilla/5.0 (iPad; U; CPU OS 4_2_1 like Mac OS X; ja-jp) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8C148 Safari/6533.18.5
Launch Mozilla. Go to Tools > Default User Agent > Edit User Agents…
Click on New > New User Agent. See below snapshot.
In New User Agent dialog box, enter Description and paste the above user agent in User Agent field and other details as shown below and then click on OK.
Type the www.QAInsights.com in the address bar and press enter. Mozilla displays the webpage as same as how it displays in iPad.
This add-on helps to validate the webpage look and feel. Also it reveals more cosmetic defects, if you use it in early stages of Software Development Life Cycle (SDLC).
How to perform performance testing using User Agent?
Using JMeter tool, it is much easy to send user agent string the request header by parameterizing user agents. We will see it in next blog post.
- Quick Testing of apps and webpages across mobiles, tablets, and other handheld devices in different platforms
- Easy Implementation
- Saves time and effort
- Performance and Compatibility Testing can be achieved by changing the user agents
- Unboxing Apache JMeter 4.0 - February 13, 2018
- Swagger Inspector and Swagger Hub Hands-on - January 25, 2018
- Speedometer 2.0 Testing - January 17, 2018
- Performance Analysis of Rajini Makkal Mandram Website - January 8, 2018
- Must Have Tools For Technical Founders - November 9, 2017