I am using CSV file which contains variables for my XML requests. I know how to see the request sent, but I would like to save each request in
The easiest way seems to be using Flexible File Writer, you can save requestData
into a file.
If you need more flexibility - for HTTP Request samplers you can do it with Beanshell Listener like:
Put the following code into the Listener's "Script" area
import org.apache.commons.io.FileUtils;
String data = ctx.getCurrentSampler().getArguments().getArgument(0).getValue();
int threadNum = ctx.getThreadNum();
int loop = ctx.getVariables().getIteration();
FileUtils.writeStringToFile(new File("request-" + threadNum + "-" + loop + ".txt"),data);
You'll get files like request-x-y.txt
generated in JMeter's "bin" folder where:
x
- JMeter Thread Numbery
- Current Loop Iteration (Thread Group level) See How to Use BeanShell: JMeter's Favorite Built-in Component article for more information on using Beanshell in JMeter tests.