Correlation: Dynamic data handling using Apache JMeter

In this article, We will talk about how to handle dynamic data in JMeter which is  basically Correlation. Correlation is the important aspect of scripting. Proper handling of dynamic data results in building effective test scripts.

What is Correlation and why is it required ?

Correlation is an act of fetching dynamic data from preceding requests/calls and posting it to the subsequent requests/calls. Lets envision an example to find out why we need correlation. Suppose we have recorded a scenario in which user does the following transactions

  • User enters login details and click submit button,
  • Home page opens and user take further actions,
  • And then Logs out of the system.

Soon after recording if you try to run the script, it may even fail for a single user. This might be because of numerous reasons, lets assume that one of the reason might be authentication mechanism implemented. When a user logged into the system, a unique session is created for user and it will be active until the user logs out of the system. Lets imagine, a unique tokenId is dynamically generated up on user login and is passed to the subsequent requests to validate the user actions. So, one cannot just record and playback the requests having these tokenId’s which are unique for every user sessions. Here, we need to correlate the web requests with the dynamic variables (tokenId). And for correlation, we need to use the “Regular Expression Extractor” which makes use of regular expressions or most commonly known as RegEx.

Continue reading Correlation: Dynamic data handling using Apache JMeter


My Blog 2014 in review

The stats helper monkeys prepared a 2014 annual report for this blog.

Here’s an excerpt:

A New York City subway train holds 1,200 people. This blog was viewed about 4,000 times in 2014. If it were a NYC subway train, it would take about 3 trips to carry that many people.

Click here to see the complete report.

Power Matching: Using Regular Expressions

When i started working with Apache JMeter, the documentation kept referencing something called Regular Expressions. In fact, I knew so little about this space that when a friend referred to Regular Expressions as “RegEx,” I wondered what he was talking about. Slowly i taught them to myself with the help of Wikipedia and a friend of mine. In this article, i will walk you through the basics of regular expression most commonly known as RegEx which plays a pivotal role in handling dynamic data in JMeter.

What are Regular Expressions, anyway?

Regular Expressions are a sequence of symbols and characters expressing a string or pattern to be searched for within a longer piece of text.  Regular Expressions are about “power matching.” Lets say if you want match the set containing the three strings “Handel“, “Händel“, and “Haendel” can be specified by the pattern H(ä|ae?)ndel; we say that this pattern matches each of the three strings. That is power matching using RegEx.

How do i learn about RegEx ?

Ultimately, understanding and writing Regular Expressions (RegEx) is a little bit like getting your first job. You can’t get hired without experience, and you can’t get experience without getting hired. With RegEx, you don’t really  understand them until you use them, and you can’t really use them until you understand them. So you have to learn a little bit, and then use a little bit and get them wrong, and then go back to the book and learn a little bit more. The other problem you will have with RegEx is that each character is easy. Put them all together and you get this:


And that one wasn’t very hard. The more you work with them, the easier they’ll get.So master each step, put a couple together, make some mistakes and get going. Soon you’ll be a RegEx pro.

The Backslash(\)

I always encourage people to start their “RegEx career” by learning the characters, and the best one to start with is the backslash. A backslash is different from all the other characters, as you will see. It provides a bridge between Regular Expressions and plain text. A backslash “escapes” a character. What does “escape” mean? It means that it turns a Regular Expression character into plain text. If that doesn’t make sense to you yet, hold on – I have a few examples coming.

Continue reading Power Matching: Using Regular Expressions

JMeter Complete Element Reference – Part VII

In this article, I will talk you through about the next set of JMeter elements i.e Assertions. These elements plays a crucial role in validating samplers in our test scripts. Lets discuss in detail about the advantages and disadvantages in using assertions. In case if you have missed the older articles click here.


From the previous posts, we are all aware that how to send requests and get response from the target server. Now you may have many questions running in your mind like are we receiving expected or desired response from the server, how can we validate the received response  through JMeter. In this case, Assertions come to your rescue !!

Assertions are used to perform additional checks on samplers, and are processed after every sampler in the same scope. To ensure that an Assertion is applied only to a particular sampler, add it as a child of the sampler. By default assertions can be applied only to main samples but JMeter also provides an options to include  assertions only to sub-samples or both. Scope of the assertions can be as follows:


If a sub-sampler fails and the main sample is successful, then the main sample will be set to failed status and an Assertion Result will be added. If the JMeter variable option is used, it is assumed to relate to the main sample, and any failure will be applied to the main sample only. More than one assertion can be added to the sampler, controller, thread group or test plan. Failed assertions will cause all affected samples to fail.

Continue reading JMeter Complete Element Reference – Part VII

JMeter Complete Element Reference– Part VI

In this article, we will discuss about the next set of JMeter elements i.e Pre-Processors and Post-Processors. Lets discuss in detail, how do we use these elements to build a effective test scripts . In case if you have missed the older articles click here.

Pre Processor Elements

A Pre-Processor elements executes some action prior to a Sampler Request being made. If a Pre-Processor is attached to a Sampler element, then it will execute just prior to that sampler element running. A Pre-Processor is most often used to modify the settings of a Sample Request just before it runs, or to update variables that aren’t extracted from response text.

Post Processor Elements

A Post-Processor elements executes some action after a Sampler Request has been made. If a Post-Processor is attached to a Sampler element, then it will execute just after that sampler element runs. A Post-Processor is most often used to process the response data, often to extract values from it.

Execution order of the Elements:

Lets understand in which order JMeter process the elements when multiple elements are added to the thread group.

  1. Configuration elements
  2. Pre-Processors
  3. Timers
  4. Sampler
  5. Post-Processors
  6. Assertions
  7. Listeners

Please note that Timers, Assertions, Pre- and Post-Processors are only processed if there is a sampler to which they apply. Logic Controllers and Samplers are processed in the order in which they appear in the tree. Other test elements are processed according to the scope in which they are found, and the type of test element.

Continue reading JMeter Complete Element Reference– Part VI

JMeter Complete Element Reference – Part V

In this article, we will discuss about the next set of elements i.e Timers, importance of timers, types of timers and their usage  in our test. In case if you have missed the older articles, click here 12, 3, 4.

Apache JMeter sends requests to the target server without pausing between each request by default. In that case, the target server can be over flooded with numerous requests with in a very short span which may lead to server overload. So how to prevent jmeter from overloading the target server and how to pace each request in our test execution to achieve real time behavior. The answers is quite simple Timer. 🙂

Timers allow JMeter to delay between each request which a thread makes. Timer can solve the server overload problem. Also, in real life visitors do not arrive at a website all at the same time, but at different time intervals. So Timer will help mimic the real time behavior.

Timers are only processed in conjunction with a sampler. A timer which is not in the same scope as a sampler will not be processed at all. To apply a timer to a single sampler, add the timer as a child element of the sampler. If a timer is placed before a sampler in the test script, timer will be applied before executing before any sampler. To apply a timer after a sampler, either add it to the next sampler, or add it as the child of a Test Sampler.

Continue reading JMeter Complete Element Reference – Part V

JMeter Complete Element Reference – Part IV

In this article, we will discuss about  the next set of elements i.e Logic Controllers, importance  of controllers, types of controllers and their usage  in our test. In case if you have missed the older parts, click here 12, 3.

Logic Controllers

Logic Controllers let you customize the logic that JMeter uses to decide when to send user requests. Logic Controllers basically determine the order in which Samplers are processed. They can modify the requests themselves, cause JMeter to repeat requests, etc.

Continue reading JMeter Complete Element Reference – Part IV

Recording HTTPS Traffic with JMeter’s Proxy Server

If you read our article, Recording using Jmeter HTTP Proxy Server, then you already know how to use JMeter’s Proxy Server to record HTTP traffic.
But what if a website uses SSL encryption? 
Then, you better make some configuration changes. How? We’ll tell ya’.

Record HTTPS Traffic with the JMeter Proxy Server

By default, JMeter supports recording HTTPS (SSL) in versions 2.3.4+ and HTTP Samplers are configured to accept all certificates, whether trusted or not.
To record encrypted traffic, first configure the JMeter Proxy Server and browser proxy settings. We used Firefox for this example.

HTTP Request Sampler

In the last article, we discussed about Samplers, sampler usage and many more . In case if you have missed click here. In this article, We will discuss about the most important and frequently used sampler i.e “HTTP Request Sampler”.

HTTP Request Sampler

This sampler lets you send an HTTP/HTTPS request to a web server. It also lets you control whether or not JMeter parses HTML files for images and other embedded resources and sends HTTP requests to retrieve them. The following types of embedded resource are retrieved:

  • images
  • applets
  • stylesheets
  • external scripts
  • frames, iframes
  • background images (body, table, TD, TR)
  • background sound

The default parser is htmlparser. This can be changed by using the property “htmlparser.classname” – see for details.

If you are going to send multiple requests to the same web server, consider using an HTTP Request Defaults Configuration Element so you do not have to enter the same information for each HTTP Request.

Or, instead of manually adding HTTP Requests, you may want to use JMeter’s HTTP(S) Test Script Recorder to create them. This can save you time if you have a lot of HTTP requests or requests with many parameters.

Continue reading HTTP Request Sampler