Sandeep Sharma
Sandeep Sharma

Reputation: 705

how to get all data from csv into jmeter?

I have a table on the page with maximum of 20 rows and also I created a CSV file with 20 rows in it.

Current Scenario : Jmeter is picking only one row for one user from csv file.

Required: I need jmeter to read all rows (i.e 20) for one user.

Table:

Name1 ---- roll1 --- PhnNumber1 --- date1 --- month1 --- year1 --- Dept1

Name2 ---- roll2 --- PhnNumber2 --- date2 --- month2 --- year2 --- Dept2

Name3 ---- roll3 --- PhnNumber3 --- date3 --- month3 --- year3 --- Dept3

.

.

.

Name20 ---- roll20 --- PhnNumber20 --- date20 --- month20 --- year20 --- Dept20

CSV file: Name --- roll --- PhnNumber --- date --- month --- year --- Dept

1.

2.

.

.

20.

So I do I configure Jmeter to read all 20 data from csv file for one user.

Upvotes: 0

Views: 1367

Answers (1)

Dmitri T
Dmitri T

Reputation: 168207

It's not clear in which format you want to ingest the contents of the CSV file.

Given your CSV file looks like:

Name1,roll1,PhnNumber1,date1,month1,year1,Dept1
Name2,roll2,PhnNumber2,date2,month2,year2,Dept2
Name3,roll3,PhnNumber3,date3,month3,year3,Dept3

If you need it fully inline or in a JMeter Variable (hopefully this is what you're looking for) - there is __FileToString() function

enter image description here


If you want individual values you can go for __CSVRead() function

  • ${__CSVRead(test.csv,0)} - will give you Name1
  • ${__CSVRead(test.csv,1)} - will give you roll1
  • ${__CSVRead(test.csv,next)} - will proceed to the next row

enter image description here

If you want something custom - there is __groovy() function where you have the full freedom regarding how to read the file and where and how to store the results

enter image description here

More information on JMeter Functions concept: Apache JMeter Functions - An Introduction

Upvotes: 0

Related Questions