Create a text file and save in JMeter/bin folder
Select Groovy in drop down, we have other scripting languages support also
import org.apache.jmeter.util.JMeterUtils;
String fileContents = new File('./nameOfFileToRead.txt').getText('UTF-8');
vars.put("your_fileContentsVariableName",fileContents);
log.info("Message:" + vars.get("your_fileContentsVariableName"));
Add a Debug Sampler, to get all the JMeter variables used in the test plan. Set all dropdowns as true.
In the Debug Sanpler, Response Data , we can see the text file content.
Also open the JMeter console. The same is displayed here also. Because we have used the following line.
log.info("Message:" + vars.get("your_fileContentsVariableName"));
No comments:
Post a Comment