In my webservices test plan, I am sending SOAP request to create user and it sends back username and unique id in the response data. I want to save that username and uniqueid in
You can extract data using Regex post processor and save it to a variable.
Simple data writer, Flexible data writer, Save results to a file all these can write predefined variables, responses to a file in a fixed or little bit customizable format but won't let you write your custom variables.
For writing it to a file you need to use Beanshell processor. Sample code would be,
username = vars.get("username");
password = vars.get("password");
f = new FileOutputStream("/path/user_details.csv", true);
p = new PrintStream(f);
this.interpreter.setOut(p);
print(username + "," + password);
f.close();
I used this for save a number to a csv: thanks Nachiket Kate.
folio = vars.get("folioGuardado");
f = new FileOutputStream("C:/GuardFolios/folios.csv", true);
p = new PrintStream(f);
this.interpreter.setOut(p);
print(folio);
f.close();
You can use sample_variables
property to store custom variables values into .jtl results file.
Add the following line to user.properties file (it lives under /bin folder of your JMeter installation)
sample_variables=username,password
You will see variables values within .jtl results file upon execution.
See Default Configuration chapter for explanation and Apache JMeter Properties Customization Guide for more information on different JMeter properties and ways of setting and/or overriding them.