1

I have a question how can I set up HTTP Request Sampler for HTTP PUT method in JMeter so it can read data from CSV file using CSV Data Set Config? In my scenario I'm using **Concurrency Thread Group** with the following parameters: * **Target Concurrency**: 50 * RampUp **Time** (**secs**): 10 * RampUp Steps **count**: 5 * Hold Target..(**secs**): 10

This is my CSV Data Set Config setup: enter image description here

(Java) Types of Variable Names are: bookId:Long, title:String, price:double, amount:int, authors: Set , categories: Set , isDeleted:boolean

This is my HTTP Request Sampler setup:enter image description here

...and this is content of my bookCollection10Items.csv file where quoted values are Strings, and the ones in angle brackets [] are arrays of values (as I'm updating Book that has Many-To-Many relationship with Categories/Authors):

1,"Harry Potter and Magic Stone",39.99,2500,[4],7,11,false
2,"Murder on the Orient Express",[19.98,500500],1,9,false
3,"The Murder of Roger Ackroyd",19.99,1500,1,[7,9],false
4,"Harry Potter and the Chamber of Secrets",24.99,0,4,[7,9],true
5,"Harry Potter and the Prisoner of Azkaban",17.99,1200,4,7,false
6,"The Da Vinci Code",29.99,700,8,10,false
7,"Inferno",22.50,950,8,10,false
11,"War and Peace",31.99,300,5,8,false
14,"The Trial",27.99,450,6,9,false
15,"IT",16.50,0,2,5,true

What I want to achieve is that each Thread(i.e. User) to select one item from "bookCollection10Items.csv" file in a round-robin fashion and update it for a given bookId using "All Threads" as Sharing Mode option.
Any advice/suggestion is greatly appreciated.

2

JMeter's built-in CSV Data Set Config is reading lines from the CSV file sequentially so each user will get the next line on each iteration.

If you need to read a random line (however I don't think it's a good idea as I believe tests need to be repeatable) you will need to go for some plugins like:

  1. Random CSV Data Set Config
  2. or HTTP Simple Table Server

Both can be installed using JMeter Plugins Manager

1

I've managed to find a solution with my problem -> I made a mistake by:

1) Creating CSV file in gEdit (Linuxs' equivalent of Windows Notepad) instead of using LibreOffice Calc where work is done in cells. Therefore this way (both in gEdit and LibreOffice Calc):

3,"The Murder of Roger Ackroyd",19.99,1500,1,[7,9],false

...is a no-no.

2) Removing angle brackets [] from listing so arrays would NOT contain arrays. E.g. When angle brackets are present I get this:

{
   // some other fields
   "authors" : [[7,9]]
}

3) Had to properly format numbers with decimals to contain dot, NOT comma (locale issues). E.g. Proper format is 19.99, wrong format 19,99

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.