Role of User Agent String in Software Testing

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.

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.

You can see all the user agents in the form of XML here. For instance, if you want to validate how my website will look in iPad. How do we achieve this? Read on.

Step 1

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

Step 2

  • Launch Mozilla. Go to Tools > Default User Agent > Edit User Agents…
  • Click on New > New User Agent. See below snapshot.

Step 3

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.

Step 4

Type the 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
  • Freeware
  • Saves time and effort
  • Performance and Compatibility Testing can be achieved by changing the user agents

Happy Testing!

Subscribe to our QAInsights YouTube Channel. If you are enjoying our work, please do subscribe our free weekly newsletter or Google feeds.

Role of User Agent in Software Testing Mozilla Add-on - QAInsights

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Learn Apache JMeter for free. No Strings Attached.Watch Now for FREE
+ +
Share via
Copy link