Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to parameterize the filename textfield of CSV dataset config. I am writing into different files for every user that I'm using in JMeter, hence I need to parameterize the filename option in the CSV dataset config to read the files I create for every user. How can i do that?

I'm using a user-defined variable called csvFilename which I'm referring to as ${csvFilename} in the filename option of CSV dataset config element. I'm writing into this variable the path of the filename from a BSF post-processor:


(BFS post-process enables reading variables from JMeter). In the above line of code, a username is another variable that will change according to the username I fetch from a CSV file.

So my problem is that the variable ${csvFilename} is not replacing the file's path into the Filename textfield of CSV dataset config. Am I missing something?

share|improve this question
I also tried this: I used a BeanShell script function in the path to place the username in the filename textfield of CSV dataset config like this: /home/abhijeet/load_test_plans/users/${__BeanShell(vars.get("username"))}.csv But this is not working too. Could someone please help me? – Abhijeet Vaikar Jul 11 '12 at 13:27
up vote 2 down vote accepted

Since I could not find any solution to this problem I'm facing I implemented a workaround for it by writing code into a BeanShell PreProcessor that would work like a CSV dataset config element.

The code i've written is:


String uname = vars.get("username");
System.out.println("Username at the preprocessor: "+uname);
String file_path="/home/abhijeet/load_test_plans/users//"+uname+".csv";
FileReader f = new FileReader(file_path);
BufferedReader reader = new BufferedReader(f);

String line = null;
String pt_id, first_name, last_name;
int file_counter = 0;
int gbcount = Integer.parseInt(vars.get("global_counter"));

while((line = reader.readLine()) != null){
    if(file_counter == gbcount){
        String[] fields = line.split(",");  
        pt_id = fields[0];  
        first_name = fields[1];
        last_name = fields[2];

    } else {

share|improve this answer
please click the check box next to your answer so that your question can be removed from the unanswered list. – user246 Aug 12 '13 at 16:34

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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