Write the Jmeter parameter values to a text file

Below is the BeanShell Script to write the Jmeter parameter values to a text file.

Create a Jmeter Script and Add-->Sampler-->BeanShell Sampler

Code Snippet:

String FailedUser = vars.get("P_UserID"); //Save the parameter that has to be written to a variable

f = new FileOutputStream("[Folderpath]/output.txt", true); //Path of the text file in which to write the parameter

p = new PrintStream(f); //open the text file to write

this.interpreter.setOut(p);

print(FailedUser); //Write the failed users to the text file

print(FailedUser+","+FailedUser); //optional step to print multiple comma separated variables

f.close(); // close the text file

No comments:

Post a Comment