What's New in JMeter 5.1?
What's New in JMeter 5.1?
Let's explore everything you need to know about JMeter 5.1.
Join the DZone community and get the full member experience.Join For Free
Here are some of the important things you need to know about JMeter 5.1:
Ability to Create a Test Plan From a cURL Command
Previously, users needed to click all HTTP request options within the JMeter interface in order to create a test plan. Now, you can use a simple syntax to add new HTTP requests to a test plan from a cURL command. The cURL, short for “Client for URLs,” is a command line tool for creating and executing HTTP requests from the command line. If a user already has cURL scripts, then they can also copy the cURL commands to a special popup in JMeter and generate a Test Plan.
1. To create an import from a cURL, open the ‘Tools’ menu and click ‘Import from cURL’.
2. You will then see a cURL window where you can write in your curl request. To learn more about writing your own curl request, click here. For example, if you want to show the same action that the browser would do when you click on the “Find Flights” button at blazedemo.com, you can add a POST request to ‘http://blazedemo.com/reserve.php’ with the following body: ‘fromPort=Paris&toPort=Buenos+Aires.’
The final cURL command will look like this: ‘curl -X POST -d "fromPort=Paris&toPort=Buenos+Aires" http://blazedemo.com/reserve.php
3. Then, click ‘Create HTTP Request’ button and a new HTTP Sample will be added to the Test Plan.
SubResult Naming Policy
JMeter has two ways to revert previous behavior for sub result naming policies. One way is to add "subresults.disable_renaming=true" property in jmeter.properties file. The other way is to select Functional mode checkbox. We’ll discuss both options below.
Before version 5.0, when your HTTP Sampler contained sub results, they would have their own names. In 5.0, a new custom naming policy was introduced for sub-samplers (Bug 62550): sub-result name = parent sampler name + index.
For example, in the screenshots below, you can see the difference. In the left image, you see JMeter 4.0 where you can see which functional tests had subsamplers and requests that failed. This is because the Sample label is a request URL.
In the right image from version 5.0, you can see that a sub-request failed, but you can’t understand which request was failed from the sample label because the name was modified and only contains the parent sample label + index.
There are two ways to revert to the previous behavior (before version 5.0).
The first way to ignore the new renaming policy is to turn on Functional Test Mode in Test Plan options. This is an option for those making functional tests who prefer to see labels with a request URL instead of a renamed label.
To turn on Functional Test Mode:
1. First, click test plan
2. Then, select the checkbox “Functional Test Mode”
Alternatively, you can add a subresults.disable_renaming=true property in jmeter.properties file. You can find this in JMETER_HOME/bin directory.
Pass Custom Mail.* Properties to Mail Reader Sampler
The JMeter UI has a limited set of options for config connection to the message store. By using some mail.* properties, you can add more configuration to the mail agent. The Java Mail service API provides a lot of properties for configuring pop3 protocol. This allows for a more flexible mail connection that users can customize using all Java properties that exist for Mail Agent.
Properties available include SSL configs, proxy configs, cache controls, etc. You can also configure timeout properties, which can’t be done through the JMeter UI. You can find the full list of properties that can be used for the config pop3 message store here.
This fix was implemented by Artem Fedorov and contributed by BlazeMeter.
In order to implement, you need to open jmeter.properties file in your JMETER_HOME/bin directory and add the properties that you want to configure.
For example, if I want to use proxy server, I can set up the following properties:
These properties specify an HTTP web proxy server that will be used for connections to the mail server.
JDBC Connection Configuration Improvements
With JMeter version 5.1, users can now specify init SQL statements. These can include any options that provide you with a database. For example, configurations for current sessions like disable caching and duration of the current session. You can find more configuration references here.
In order to configure the init SQL statement, you need to add ‘JDBC Connection Configuration’ to your Test Plan and write your script. In our example below, we’ll disable caching for Amazon Redshift using the following SQL statement:
To learn more about testing your database using JMeter via JDBC Sampler, you can check out this blog post.
Published at DZone with permission of Artem Fedorov , DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.