jsoncsvjmeterperformance-testinghttp-put

How to perform HTTP PUT Request by reading values from CSV in JMeter?


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:

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.


Solution

  • 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