In this blog post, we will see about how to change user agent string in Apache Jmeter. Before you read on further, I request check my last post about role of user agent in software testing and about Jmeter.
Below is the recorded Jmeter script which has one Thread Group and Loop Controller. Loop Controller has three HTTP requests. Each request has HTTP Header Manager.
HTTP Header Manager consists the headers which will be sent along with the request to the server. It usually contains following information such as Accept Language, Accept, User Agent, and Accept Encoding.
During recording, HTTP header manager stored following user agent string Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0. To change the user agent, first disable all HTTP Header Manager in your test plan.
Then, right click on the Thread Group > Add > Config Element > HTTP Header Manager. By adding HTTP Header Manager to your Thread Group, it over writes the header info for all the requests/samplers under that thread group.
Click on HTTP Header Manager, and then click on Add in the HTTP Header Manager element. New row gets added, double click on first cell i.e. Name and enter User-agent and enter the user agent string “Mozilla/5.0 (iPad; CPU OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5355d Safari/8536.25” for Safari 6.0.
Click on Save, it prompts you to save. Enter a valid name and save it. Add a View Results Tree, and execute the script.
In the View Results Tree, click on the first request, and then click on Request, you could see the new User-agent string which sent along each requests.
By sending different user agents, it will help to validate the performance of web applications in multiple devices and broswers.
- #3 – LoadSter, Google Chrome, and Sonarwhal – QAInsights Podcast - April 25, 2018
- #2 QAInsights Podcast – 184.108.40.206 and many more - April 9, 2018
- QAInsights Podcasts – First Episode - March 30, 2018
- Rajini Makkal Mandram Vs Makkal Neethi Maiyam – a tech comparison - March 5, 2018
- Do not blame it on server! - February 26, 2018