How can I simulate concurrent users with unique logins using JMeter ?
How can I split JMeter CSV Data Set over multiple load generators in case of Remote Testing?
Is there a solution to Randomize the content of the CSV before a test run?
Let me tell you a secret: you’ll get all the answers below.
You will learn how to swarm your system with dynamically behaving users thanks to JMeter CSV Data Set Config.
Ready to make a leap forward in your JMeter skills? Let’s get to the business.
When recording a test scenario, most of the time you will have to input some data in the application. This might not be a very important step, like entering your postal address before submitting your order. In there you could put anything remotely close to an address and the application wouldn’t care.
The key to properly simulate the behavior you want is to master how the CSV Data Set works.
Select Add, then Config Element, then CSV Data Set.
By adding it on Test Plan level, all thread groups share the same Data Set.
The location where you add the CSV Data Set is important: the variables are set for all elements at same level or below.
Now let’s explore how you can configure the Data Set.
Variable Names: comma-delimited list of names, should be equal number of names than columns in CSV file. Example: login, password.
Sharing Mode: defines how values are distributed among concurrent threads.
Wow! There are many settings out there for sure. Let’s try different combinations of settings and experience the resulting effect.
In JMeter, the way to go is to use a CSV data set config element.
Not that different from the default one, is it?
Just a quick note, for it to work that way, the simple.csv file must be in the same folder than your test plan. Additional details can be found in the official documentation.
Look, now you already master the CSV Dataset configuration. Let’s see how it behaves when running a quick test!
The crucial part is to get how the Sharing Mode is working. Once you understand it, everything will unfold nicely.
That’s actually a good illustration of what the sharing mode means.
None of the two threads is using the same value at the same time because we configured the list to be shared amongst all threads. In this situation, JMeter will give each thread a different value from the file each time they start a new loop.
Another setting we can clearly see is the Recycle on EOF. We had 4 values in this file and ran 2 x 4 = 8 loops total, so after the first 4 loops you can see we went back to the beginning of the list.
This is the point where you are curious about other possible settings.
Now what happens if we change the sharing mode to Current thread ?
Each thread is now going through its own version of the file, sequentially.
Now you’re ready to explore the next part: What happens when a thread reaches the end of the file?
By the way I would not recommend using this option unless you add some control over the value because as you can see it’s replaced with <EOF>.
It may be better to stop the thread instead of getting a weird default value on next iterations.
That’s particularly useful when dealing with unique data that you can’t reuse or need to restore before running another test.
Does JMeter Data Set allow to randomize the way values are picked from the CSV file?
As I know you can’t wait to get the answer, OctoPerf addresses them all.
The CSV Data set of JMeter is pretty powerful but it lacks some features to make it even easier to run.
Randomizes the content of CSV Files as requested per the user.
These two powerful features truly make CSV Data Sets fantastically easy to use at scale.
And also, later you can use our auto-completion menu to use your variables.
When you plan on running a distributed load test and would like the values to be unique per thread, JMeter requires you to split the file manually across all the instances you want to use. This process can be quite long depending on your test configuration. But in OctoPerf we will automatically split the file between all the JMeter instances so that you do not have to worry about it.
Another thing you cannot do in JMeter is randomize the order of values in the file.
With this option we will shuffle the values before splitting the file across all test machines.
For further assistance, take a look on the following presentation introducing How to Design Realistic Users using OctoPerf. It demonstrates how to import and use a CSV file.
Hi, I’ve a use-case where I want to keep a CSV file only in a single private AWS network Linux machine which has private IP (e.g. //10.10.21.31/var/www/Jmeter/testdata.csv). How can I give the path address of this file location to a Jmeter Script running on the same private network in Jmeter CSV Data set Config?
Why not mount an NFS Shared disk? Then you can simply refer to the file using a local file path like /path/to/nfs/file.csv. You could also mount a shared Amazon EBS volume on multiple AWS EC2 instances in read-only for example. Or maybe write a script which launches JMeter but downloads the CSV files from a given location to the local machine first.