I'm trying to read multiple csv files from a specific folder using Jmeter
Until now I read one csv file and I could loop it with a thread that runned X times when X- is the number of lines in the file. I was counting the number of lines in the csv file before the thread with a bean_shell like that:
import org.apache.jmeter.services.FileServer;
String DirPath = FileServer.getFileServer().getBaseDir();
FileReader fileReader = new FileReader(new File(DirPath + "/files/App1.csv"));
LineNumberReader lineReader = new LineNumberReader(fileReader);
int linenumber = 0;
while (lineReader.readLine() != null){
linenumber++;
}
props.put("rowsnumberApp", Integer.toString(linenumber));
Now, I want to read multiple files from a folder, when the amount of files in the folder can dynamically change,
The files names will be like that:
app1
app2
app3
app...
I have this code to read all files from the folder:
import org.apache.jmeter.services.FileServer;
String DirPath = FileServer.getFileServer().getBaseDir();
File folder = new File(DirPath + "/files");
File[] files = folder.listFiles();
int counter = 1;
for (File file : files) {
vars.put("file_" + counter, file.getAbsolutePath());
counter++;
}
Each file has different amount of lines (but at least I have the same soap-request for all of them)
I realized that using a loop controller on csv gives only the first line.
And as you can see I already have the code part for reading files from a folder and counting the number of lines,
I just need a way to connect all of this to be able to loop for all csv files in the folder
so any idea?

