JMeter Tips and Tricks – Episode 1

Hi All, In this articles, I’ll write about JMeter’s key features. JMeter is a powerful tool for performance testing. But there are many features which help test engineer enrich their test scenarios. Let’s start!

Case One

We need to simulate a user group who browse some links in an e-commerce website.


Browsing scenarios are very hard to maintain as that page changes frequently and you don’t want to record those page every time you execute the test.


Xpath Extractor and ForEach Controller

We have an HTTP Sampler (Cars) which make a GET request to a page. There are 20 listings on that page. In order to fetch all the different URLs, we need to use XPath Extractor.

XPath Extractor should have a xpath query (//a[@class=’classfiedTitle’]/@href) to fetch URL’s on the page and those links should be stored in a variable (extractedLink). If the list is empty, it will have a default (NO) value.

In order to make a GET request to all the URL’s, we need to use ForEach Controller which works with a set of object. So reference name of the fetched URLS(extractedLink) should be given as input and output.

Then we need to pass this variable name (extractedLink) to the path field of the next HTTP sampler. Preferably you may give the fetched URL’s name to the HTTP Sampler. So we may observe the results easily.

The results are here, our Thread is making GET request to all URLs on that page.

Case Two

We need to simulate a user who browses a content oriented website.


When JMeter record a web site, it stores the CSS, jpg, js file that are valid during the recording time. But content oriented web sites like the newspaper, forums etc tends to change their content very frequently. That’s why when you run the test next day, those requested files won’t be valid. They would not be a good fit because the content is already aged. We need to make GET request to new resources.


We create an HTTP Sampler and make a GET request to the page and enable “Retrieve All Embedded Resources” under the Advanced tab of this sampler.

By this way, our sampler will always make a call to the updated web site. You don’t need to record test cases once again.

Case Three

Our test environment URL is changing or we have many of them.


In general, URLs are hardcoded in the scripts, we need to make URL changeable.


We need to create an HTTP Request Defaults object in our Test Plan to overwrite URLs, port and other configurations stored in HTTP Samplers.

In this example, we overwrite URL, port and protocol config by new values. But most important information to remember is that you should delete those URL, port and protocol info in all HTTP Samplers.


Database Operations in JavaFX

By Onur Baskirt / Apr 1, 2016 / 56 Comments
Before started this section, please check the first article and learn How to Start JAVAFX! At first, part of JavaFX tutorial series, we created a sample JavaFX project, designed the draft version of the UI and set up an...
rest assured

REST API Testing with Rest Assured

By Onur Baskirt / Mar 8, 2016 / 32 Comments
Outline In this post, I will explain what is API and API testing, what is the difference between SOAP and REST services, and how to test REST APIs with Rest Assured Library. What is API? API stands for Application Programming...

How to Write Effective CSS Locators

By Onur Baskirt / Oct 1, 2017 / 0 Comments
Hi all, in this tutorial, I will describe you how to write effective CSS locators to interrogate web elements for your automation projects. As a rule of thumb, your interrogation strategy should be in below order: First try to use...

Selenium-11: Execute JavaScript with JavascriptExecutor

By Onur Baskirt / Jan 27, 2016 / 15 Comments
Outline Sometimes we cannot handle some conditions or problems with Webdriver, web controls don't react well against selenium commands. In this kind of situations, we use Javascript. It is useful for custom synchronizations, hide or show the web elements, change...

Getting Started with JavaFX

By Onur Baskirt / Mar 25, 2016 / 0 Comments
When I started to work in my current position, one of my task is to do manual operations for campaign products  every week. After the second week, I thought that I have to automate this task using a GUI based...

How to Write Smart XPath Locators

By Onur Baskirt / Sep 24, 2017 / 4 Comments
Hi all, in this tutorial, I will describe you how to write smart and non-brittle XPath locators. When we write our test scripts, we generally prefer to use id, name, class, etc. these kinds of locators. However, sometimes we could not...

Selenium-1: Quick Start to Automation with Selenium WebDriver & JAVA & JUnit & Maven & IntelliJ

By Onur Baskirt / Sep 8, 2015 / 26 Comments
Outline Selenium Webdriver is the most popular open source web test automation framework across wide range of browsers and platforms. In this tutorial you will learn how to do web test automation with Selenium Webdriver and the related tools. Audience...
page object model

Page Object Model with C#

By Ege Aksoz / Jun 18, 2017 / 8 Comments
In the previous tutorial, we’ve taken the initial steps and entered the world of automated testing. We also wrote our first automated test. From this point on, since we are not just going to write one test, we need to...

How to Select a Date From DatePicker Using Selenium

By Onur Baskirt / Aug 13, 2016 / 6 Comments
When you need to automate a airway, hotel, or similar websites you need to deal with Datepickers and some times it is a little bit cumbersome to select a specific date on the Datepicker or calendar.  In this post, I...

Selenium Webdriver Performance testing with Jmeter and Selenium Grid

By Ozgur Kaya / Aug 9, 2016 / 2 Comments
In this post, we will complete Selenium Webdriver Performance testing scenario using Jmeter and Selenium Grid. 1- Install Java 7 or later If necessary 2- Download latest Jmeter version 3.0 or higher. 3- Download Jmeter PluginsManager JAR file and...
By | 2017-04-03T15:16:50+00:00 April 3rd, 2017|Jmeter, Performance Testing|0 Comments

About the Author:

Canberk Akduygu
Canberk Akduygu is working as a Technical QA Architect on test automation and performance testing. Formerly, he worked at TEB as QA Project Lead, Ayrotek IBM Business Partner and Yapi Kredi Bank as Java Developer. You can also follow him on Linkedin.

Leave A Comment