如何将文件的内容放入JMeter 的全局变量中?
How to put the content of a file in a global variable in JMeter?
我想一次性将一个文件的内容保存在一个变量中,然后在 JSR223 预处理器脚本中使用它。
我该怎么做?
添加User Defined Variables to your Test Plan and define the variable name of your choice, i.e. myFile
. As the value use __FileToString() function并提供您要加载的文件的路径:
完成后,您可以使用 vars
shorthand for JMeterVariables class 实例引用来自任何 JSR223 测试元素的文件内容:
String myFile = vars.get('myFile')
我想一次性将一个文件的内容保存在一个变量中,然后在 JSR223 预处理器脚本中使用它。 我该怎么做?
添加User Defined Variables to your Test Plan and define the variable name of your choice, i.e.
myFile
. As the value use __FileToString() function并提供您要加载的文件的路径:完成后,您可以使用
vars
shorthand for JMeterVariables class 实例引用来自任何 JSR223 测试元素的文件内容:String myFile = vars.get('myFile')