I want to save the content of a file in a variable one time and use it in JSR223 pre-processor script. How can I do this?
Add User Defined Variables to your Test Plan and define the variable name of your choice, i.e. myFile
. As the value use __FileToString() function and provide the path of the file which you want to load:
Once done you can refer the file content from any of the JSR223 Test Elements using vars
shorthand for JMeterVariables class instance as:
String myFile = vars.get('myFile')