JMeter – Version 5.0

A new Apache JMeter Version 5.0 was released this week.

Below are some of the important updates that are available in JMeter 5.0.

Core improvements

Rest support has been improved in many fields

  • Multipart/form-data requests now work for PUTDELETE …
  • It is now also possible to send a JSON Body with attached file
  • Parameters entered in Parameters Tab are now used in body instead of being ignored

In distributed testing, JMeter now automatically prefixes thread names with engine host and port, this makes the counting of threads correct in the HTML report without any other configuration as it was required before

XPath 2.0 is supported in a new element called XPath2 extractor providing easier XML namespaces handling, up to date XPath syntax and better performances

Upgrade to HTTP Components 4.6 last APIs has been completed and JMeter does not rely anymore on deprecated APIs of this library

It is now possible to control in an easier way Loop breaking and Loop switching to next iteration. This is available in Flow Control Action and Result Status Action Handler elements

While Controller now exports a variable containing its current index named __jm__<Name of your element>__idx. So for example, if your While Controller is named WC, then you can access the looping index through ${__jm__WC__idx}

Scripting / Debugging enhancements

Search feature has been improved to allow you to iterate in the tree over search results and do necessary replacements through Next/Previous/Replace/Replace/Find buttons

In View Results Tree, the request and response headers/body are clearly separated to allow you to better inspect requests and responses. You can also search in all those tabs for a particular value

Recording feature has been improved to provide a popup that is always on top when you navigate in browser allowing you to name transactions while you navigate in your application.

You can now restart JMeter from menu File → Restart

Live Reporting and Web Report

Reporting feature has been enhanced

A new Graph Total Transactions per second has been added to the HTML Web Report

It is now possible to graph over time custom metrics available as JMeter Variables through sample_variables. Those custom metrics graphs will be available in the HTML Report in Custom Graphs section

Hits per second graph now takes into account the embedded resources

In Live reporting, the sent and received bytes are now sent to Backends (InfluxDB or Graphite)


Debugging problems when recording with the JMeter Proxy

How to debug problems when recording

JMeter Proxy does not record samples

If the browser is working OK, but the Proxy is not recording samples, then check that the browser really is using the JMeter Proxy.

One way to do this is to stop the JMeter Proxy. If the browser continues working, then it is clearly not using the Proxy.

Double-check the browser proxy settings. Clear the browser cache.

The JMeter proxy works by capturing the browser request, creating a sampler and adding it to the test plan, and then it runs the sampler. The response from the sampler is returned to the browser.

It’s very unlikely that the JMeter Proxy could return a response to the browser without the sampler appearing in the test plan. However, it’s worth checking the JMeter log file just in case.

Creating Regular Expressions in JMeter

Creating Regular Expressions
Regular expressions can be a bit daunting at first, so here is a suggested procedure to help create them.

Getting Started
Ensure you have an exact copy of the source document that you want to operate on.

One way to do this is to attach a Save Responses to a file Listener to the Sampler, and run the test to create a copy of the resource.

You can then use the HTTP Sampler with the “file:” protocol to retrieve the page at any time.

Extract the section you are interested in
Find the variable part that you want to extract (in the file, or in the Tree View Listener), and start by using that as the regular expression.

For example, suppose you want to find the value from the following snippet:

input type=”hidden” name=”secret” value=”CAFEBABE.12345(3)”

Start with exactly that as the regular expression, and check that it works, for example in the Tree View Listener Regex tester panel.

If not, examine the expression for any meta-characters (characters that have a special meaning in regexes).In this case, the only special characters are the “.” and the parentheses “(” and “)”.These need to be escaped, by being prefixed with “\”. We now have:

input type=”hidden” name=”secret” value=”CAFEBABE\.12345\(3\)”

This should now match the whole phrase.

The next stage is to tell the regex processor which part of the section you want to use. This is easy, just enclose the characters in parentheses.

So assume you want to match just


Your regular expression then becomes:

input type=”hidden” name=”secret” value=”(CAFEBABE\.12345)\(3\)”

Fix the expression so it matches variable text

Of course, the previous expression is not much use, as the text it matches is already known. We want to match variable text, so we have to replace the fixed characters of the target text with meta-character expressions that will match all possible variations of the target.

This requires knowledge (or a good guess) as to what possible characters can be used in the target.

In this case, it looks as if there is a string of hex characters followed by a number, followed by a digit in parentheses.

A digit is easy, that’s “\d”, so a number is “\d+”, where the “+” means one or more of the previous item.

A hex character can be represented by “[0-9A-Za-z]”. The enclosing “[ ]” create a ”character class” which matches one of the specified characters.
The “-” here means a range.

So putting that together, we get:

input type=”hidden” name=”secret” value=”([0-9A-Za-z]+\.\d+)\(d\)”

Now suppose we wanted to match the whole of the value. We could move the closing capture parenthesis to the end of the value.

This would be suitable if there were other values with different patterns that we did not want to match.

However, if we just wanted to capture the quoted value, then we could use:

input type=”hidden” name=”secret” value=”([^”]+)”

The character class in this case is ”[^”]” which means any character except double-quote. The “+” suffix means we want as many as there are in succession.

This will take us up to the end of the value.

Hints and Tips

If the expression matches more than once in the source, you have a choice:

* specify which match to use
* extend the expression to include more context at the beginning or end so the match is unique