0
votes

i have a page that creates bulk users in my application, and i was wondering if it's possible to use the created users and put them in my users.csv file (CSV Data Set Config element) so that i will use those users in the current test only.

the idea is to have dynamic users.csv file each test instead of fixed one, for all concurrent tests.

please advise, thanks.

1

1 Answers

0
votes

Yes, You can do in the current test - But in a different thread group when you run consecutively.

Use BeanShell PostProcessor to write the created users in a CSV file as given below in the Thread Group 1.

import org.apache.jmeter.services.FileServer;

f = new FileOutputStream("CSV file Path.csv", true); 
p = new PrintStream(f); 
p.println(vars.get("username") + "," + vars.get("password"));
p.close();
f.close();

Then you can use CSV Data Set Config to read the same file and get the User Name , Password in the Next Thread Group.

If you want to use it in the same Thread Group, You can write in the CSV file - but use vars.get("username"), vars.get("password") in your test - as you can not read the CSV file yet to be created using CSV Data Set Config.