Artem Fedorov is a Java Developer at BlazeMeter. He specializes in writing plugins for JMeter. He also develops BlazeMeter plugins for Jenkins, TeamCity and Bamboo CI. Artem maintains and develops the Jenkins Performance Plugin.

Learn JMeter in 5 Hours

Start Learning
Slack

Test Your Website Performance NOW!

arrow Please enter a URL with http(s)
Nov 07 2017

Introducing the Random CSV Data Set Config Plugin on JMeter

The Random CSV Data Set plugin is a new Apache JMeter™ plugin that I developed (released November 2017), which solves data driven testing needs. The Random CSV Data Set Config plugin provides the capability to parameterize your Test Plan from a CSV file in random order of records. Until now, JMeter users who used the default CSV Data Set Config element could only read records in sequential order. The Random CSV Data Set Config plugin solves this problem.

 

How to Get the Random CSV Data Set Plugin Now

 

The Random CSV Data Set Config plugin is available to download from the JMeter Plugins Manager.

 

1. Open the JMeter Plugins Manager on JMeter (If you haven’t it, read How to Install the JMeter Plugins Manager)

 

2. Select ‘Available Plugins’ tab on JMeter Plugins Manager

 

3. In the search field write ‘Random’, and then select the plugin’s checkbox

 

4. Click the button ‘Apply Changes and Restart JMeter’

 

jmeter random csv data set plugin

 

How to use the Random CSV Data Set Config plugin

 

First, create a test-plan that contains one Thread Group. A Thread group consists of an “HTTP Request” and a “Random CSV Data Set Config”. Also, add a “View Results Tree”.

 

how to randomly parameterize csv file records, jmeter

 

Then select the “Random CSV Data Set Config” element in your Test Plan tree and set it up with the following settings:

 

jmeter, csv data set config, open source

 

A description of these parameters:

  • Filename - The path to your file. Relative paths are resolved with respect to the path of active test plan.
  • File encoding - The encoding that will be used to read this file.
  • Delimiter - The delimiter that will be used to split records in the file.
  • Variable names - This is the equivalent to a “column name” in a spreadsheet.
  • Random order -  The plugin will get records from the file in random order. This is the part that provides this element’s added value. If you don’t select this option, the element will work like the regular CSV Data Set Config.
  • Rewind on end of list - After one loop of testing completes, JMeter runs another one. This is valuable for checking your performance over time. When this is checked with “Random order”, the second and following loops will test the variables in a different order each time.
  • First line is CSV header - If you specified “Variable names” and you want to skip the first line in the file check this checkbox.
  • Independent list per thread - Each thread will go through their own copy of the reader. This imitates real-world scenarios. When this is checked with “Random order”, each thread runs its own random sequence instead of all of them going over the same order of variables.

 

Click ‘Test CSV Reading’ to see if the plugin works with the settings provided. You don’t have to run the complete test, as required until now in JMeter, thus saving time and resources.

 

In the preview area you can see how the plugin parsed this file. Please note that the preview area only shows 20 records from the CSV file.

 

Here you can see the content of the file in a simple text editor:

 

jmeter, parameterization, guide

 

After you set up the “Random CSV Data Set Config” element, select the “HTTP Request” component in your Test Plan. For example, we’ll send a Log In request with two parameters: ‘login’ and ‘password’.

 

configuring the random csv data set config

 

In the ‘HTTP Request,’ specify the HTTP Method, Path, and parameters that will be sent. As you can notice, the value field has the same name as the variable in the 'Random CSV Data Set' or header from your file. The construction ${….} means it is variable, but not an absolute value.

 

After these steps, save your Test Plan and run the test. In ‘View Results Tree’, we can see that the requests was sent with the values from our CSV file:

 

jmeter plugins manager, plugins, random csv data set config

 

WARNING: The config reads the files at the beginning of the test. Therefore, there will be a delay and a large memory consumption for larger files.

 

That’s it! You now know how to use the CSV Data Set Config Plugin, which was developed as part of BlazeMeter’s investment in the JMeter open source community.

 

Now that you know how to use the Random CSV Data Set Config Plugin, you can learn more JMeter from our free JMeter Academy.

 

Click here to subscribe to our newsletter.

 

To try out BlazeMeter, which enhances JMeter abilities, put your URL or JMX file in the box below, and your test will start in minutes. You can also request a demo.

     
arrow Please enter a URL with http(s)

Interested in writing for our Blog?Send us a pitch!