Skip to main content
Back to blog
tutorials 14 April 2020 2 min read

JMeter Correlation

Learn how to handle dynamic values in JMeter test automation through correlation using Boundary Extractor and Regular Expression Extractor.

M

Mark

Performance Testing Expert

When automating the process of test assets there are often dynamic values that need to be handled through correlation. While LoadRunner provides auto-correlation and Blazemeter offers SmartJMX auto-correlation via proxy, standard JMeter requires manual setup using its extraction processors.

Understanding Correlation

Correlation is the process of capturing dynamic values from server responses and using them in subsequent requests. Common examples include:

  • Session IDs
  • CSRF tokens
  • Dynamic identifiers
  • Authentication tokens

Boundary Extractor Method

The Boundary Extractor allows you to extract values by specifying the text that appears before and after the target value.

For example, to extract a value like d41d8cd98f00b204e9800998ecf8427e from a string containing blog-collection-list-, configure the extractor as follows:

SettingValue
Left Boundaryblog-collection-list-
Right Boundary-
Match Number-1

Using match number -1 captures all matching instances as separate variables:

  • blogcollectionlist_1
  • blogcollectionlist_2
  • etc.

A count variable is also created to track the total number of matches.

Regular Expression Extractor Method

An alternative approach uses regular expressions for more flexible pattern matching.

For the same extraction, use:

SettingValue
Regular Expressionblog-collection-list-([a-z0-9]+)
Template$1$
Match Number-1

This generates similarly-indexed variables:

  • blogcollectionlist_1_g1
  • blogcollectionlist_2_g1

The g1 suffix indicates the capture group assignment.

Using Extracted Values

Both methods enable subsequent test steps to reference extracted values via JMeter variable syntax:

${blogcollectionlist_1}

Or for regex extractions:

${blogcollectionlist_1_g1}

Choosing Between Methods

  • Boundary Extractor: Simpler for straightforward extractions where you know the surrounding text
  • Regular Expression Extractor: More powerful for complex patterns or when you need multiple capture groups

Further Reading

Correlation is one way a test can pass while testing nothing. There are others — see Three things that silently break when you migrate a performance test, particularly the session-handling failure, which produces a run full of 200s from a login page.

Tags:

#jmeter #performance-testing #correlation #regex #automation

Free performance testing cheat sheets

36 quick-reference sheets covering JMeter, k6, Gatling, Docker, Kubernetes and observability. Free — just your email address.

Get the cheat sheets

Delivered by email. Unsubscribe any time — see our privacy policy.

Stuck on this in your own test suite?

I take on fixed-price, fixed-turnaround performance work — script migrations, HAR-to-script conversion and written performance audits. No calls required.

Get in Touch