While working for a data scraping project using Jmeter, we wanted to write up the variables into an external csv file. Task was accomplished by performing following tasks
Add a BSF PostProcessor - Add following lines
Add a BSF PostProcessor - Add following lines
FileWriter fstream = new FileWriter("e:\\test1\\test2\\results.txt",false);
BufferedWriter out = new BufferedWriter(fstream);
int temp3 = Integer.parseInt(vars.get("Store_matchNr"));
for(int i = 1; i < temp3 ; i++)
{
temp1 = vars.get("Store_"+i+"_g1");
temp2 = vars.get("Store_"+i+"_g2");
out.write(temp1);
out.write(",");
out.write(temp2);
out.newLine();
out.flush();
}
out.close();
BufferedWriter out = new BufferedWriter(fstream);
int temp3 = Integer.parseInt(vars.get("Store_matchNr"));
for(int i = 1; i < temp3 ; i++)
{
temp1 = vars.get("Store_"+i+"_g1");
temp2 = vars.get("Store_"+i+"_g2");
out.write(temp1);
out.write(",");
out.write(temp2);
out.newLine();
out.flush();
}
out.close();