[英]JMeter read from csv file to array
Is there any possibility to read files from .csv into array of variables?是否有可能将 .csv 中的文件读取到变量数组中?
Instead of getting:而不是得到:
https://loadtest.com/mo/75245.json
https://loadtest.com/mo/190554MHG.json
https://loadtest.com/mo/190223MJG.json
https://loadtest.com/mo/198533FTR.json
... ...
I would like to get an array:我想得到一个数组:
https://loadtest.com/mo/75245.190554MHG.190223MJG.198533FTR.19023.HGTYTRWEYRWEHF.1922MHGDGO.json
Does anybody have some idea?有人有什么想法吗?
Thank you in advance.提前谢谢你。
Check out the following JMeter Functions :查看以下JMeter 函数:
A workaround for this, if you don't want to use Groovy, can be using text editor that supports regex (like Notepad++) to restructure your CSV, so that multiple lines are collapsed into a single multi value line.对此的解决方法是,如果您不想使用 Groovy,可以使用支持正则表达式的文本编辑器(如 Notepad++)来重构您的 CSV,以便将多行折叠为单个多值行。
An example for Notepad++ would be replacing all instances of: ^(.+)\\R(.+)\\R(.+)\\R
With $1 $2 $3
To collapse every 3 lines of text into a single line. Notepad++ 的一个例子是替换所有实例:
^(.+)\\R(.+)\\R(.+)\\R
With $1 $2 $3
将每 3 行文本折叠成一行。
Then you can just use that one line as a single variable in JMeter.然后,您可以将该行用作 JMeter 中的单个变量。 This way I've passed multiple comma separated Ids into an array in an Http request.
通过这种方式,我将多个逗号分隔的 ID 传递到 Http 请求中的数组中。 Remember to use a different delimiter in JMeter CSV Data Set Config for actual CSV columns, than the one used to delimit your multiple values.
请记住在 JMeter CSV 数据集配置中为实际 CSV 列使用不同的分隔符,而不是用于分隔多个值的分隔符。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.