The Latest JMeter Update: JMeter 5.6

The Latest JMeter Update: JMeter 5.6

The Apache JMeter team announced its latest update, JMeter version 5.6, in August 2023. Let’s now take a look at the improvements and new…

The Latest JMeter Update: JMeter 5.6

The Apache JMeter team announced its latest update, JMeter version 5.6, in August 2023. Let’s now take a look at the improvements and new features in this version.

Although JMeter 5.6 does not introduce revolutionary features, the update offers valuable improvements for existing users.

What’s new with JMeter 5.6?

Some of the new features coming with JMeter 5.6 are:

  • Improved browser simulation(Fetch resources referenced in <link “rel”=”preload”…> elements)
  • Template-based labels for recorded samplers
  • Creating a plan with Java DSL(also Kotlin DSL)
  • Parameterized checkbox values
  • Enhanced handling of non-ASCII characters(UTF-8 as default)

Let’s take an in-depth look at these new features.

Improved browser simulation: JMeter now offers better support for embedded resource retrieval, addressing specific edge cases involving the rel=preload attribute.

Template-based labels for recorded samplers: Users can define labels for recorded samplers using templates such as #{url}, #{method}, #{scheme}, #{host}, #{port}, offering greater flexibility and organization in test plans.

Creating a plan with Java DSL: JMeter 5.6 introduced Java DSL, which allows you to create and run performance tests as code. This makes it easier to create and maintain test plans, as the structure of the code will resemble the structure of the created test plan tree.

Before JMeter 5.6, it was possible to create a test plan from code either by using JMeter API or via JMeter DSL, But it doesn’t support all of the JMeter features.

Now it’s possible to create test plans using Java and Kotlin, here’s the example code for Java DSL:

import org.apache.jmeter.sampler.DebugSampler 
import org.apache.jmeter.testelement.TestPlan
import org.apache.jmeter.threads.ThreadGroup
import static org.apache.jmeter.treebuilder.dsl.TreeBuilders.testTree ListedHashTree root = testTree(b -> { // Firstly, we create a TreeBuilder
b.add(TestPlan.class, tp -> { // Then we add elements to the tree
b.add(ThreadGroup.class, tg -> {
tg.setName("Search Order Thread Group");
b.add(DebugSampler.class); // If no children needed, you could omit the lambda parameter
b.add(new DebugSampler()); //By default, JMeter uses no-argument constructors to create elements, however, you can add TestElement instances to the tree as well
});
});
});

Here’s the example code for Kotlin DSL:

import org.apache.jmeter.sampler.DebugSampler 
import org.apache.jmeter.testelement.TestPlan
import org.apache.jmeter.threads.ThreadGroup
import org.apache.jmeter.treebuilder.dsl.testTree

val root = testTree { // Firstly, we create a TreeBuilder
TestPlan::class { // Then we add elements to the tree
ThreadGroup::class {
name = "Search Order Thread Group"
+DebugSampler::class // If no children needed, the element can be appended to the tree with a unary plus operator
+DebugSampler() // By default, JMeter uses no-argument constructors to create elements, however, you can add TestElement instances to the tree as well
}
}
}

You can even generate Kotlin DSL of your test plan simply by using “Copy Code” feature of JMeter GUI:

Parameterized checkbox values: Checkbox values can now be parameterized using functions or variables. It was necessary to edit the .jmx script beforehand for this process.

Enhanced handling of non-ASCII characters: JMeter Proxy and Samplers now utilize UTF-8 encoding by default, simplifying the handling of characters outside the standard Latin alphabet during test recording and playback.

JMeter 5.6 also includes various bug fixes, performance improvements, JAR upgrades, and accessibility enhancements.

It’s important to note that JMeter 5.6 requires Java 8 or later for execution, with Java 17 or later being recommended for optimal performance.

Additionally, the change log for the latest version can be accessed at https://jmeter.apache.org/changes.html page.

Thank you for reading this article. To stay updated with our latest posts, follow our blog and visit our website.