0
votes

My test case is to send a given number of rows in sequence from CSV file to HTTP request body in each request. I tried using CSV Data Set Config but it allowing read only single row for each request. Is it possible to read data from CSV in given batch (eg. 5 simple comma separated plain text rows in each request body) using JMeter ?.

Let's say I have CSV file test.csv with 10 records.

no,name,email
1,test,test@test.com
2,test,test@test.com
3,test,test@test.com
4,test,test@test.com
5,test,test@test.com
6,test,test@test.com
7,test,test@test.com
8,test,test@test.com
9,test,test@test.com
10,test,test@test.com

Now I want to send 2 rows (simple comma separated plain text rows) from this CSV to JMeter HTTP request body. Is it possible using JMeter?

I tried using CSV Data Set Config but it doesn't provide such functionality.

1

1 Answers

0
votes

This is a very custom use case therefore you have to go for scripting using __groovy() function

Example syntax:

${__groovy(new File('test.csv').readLines().subList(1\,3).join('\,'),)}

Demo:

enter image description here

More information on Groovy scripting in JMeter: Apache Groovy - Why and How You Should Use It