[英]How to read multiple values in one row from csv file to post body as variable in Jmeter
How to make an Post HTTP request Body from multiple values in a single column from a CSV file?如何从 CSV 文件的单个列中的多个值创建 Post HTTP 请求正文?
In CSV file, under the transactional_currencies
, I need to insert two or more values as per requirement.在 CSV 文件的
transactional_currencies
下,我需要根据要求插入两个或更多值。
This is the Json Body need to pass in Post HTTP request Body这是 Json Body 需要在 Post HTTP 请求 Body 中传递
{
"country_name": "${country}",
"status": "$ {status}",
"transactional_currencies": ["${transactional_currencies[0]", "${transactional_currencies[1]"]
}``
``
``
I'm not sure about what did you ask but let's give it a try我不确定你问的是什么,但让我们试一试
You should define a delimiter character in your CSV dataset config element.您应该在 CSV 数据集配置元素中定义一个分隔符。
For example例如
Single Line in our CSV: sample@sample.com,testusername,testpassword我们 CSV 中的单行:sample@sample.com,testusername,testpassword
Not with the CSV Data Set Config不适用于 CSV 数据集配置
If you have fixed number of entries in the transactional_currencies
(ie always 2) you can use __CSVRead() function where you will be able to decide when to go to the next entry/row.如果您在
transactional_currencies
中有固定数量的条目(即始终为 2),您可以使用__CSVRead() function ,您可以在其中决定何时将 go 转到下一个条目/行。
If the number of entries in the transactional_currencies
is dynamic, you can go for JSR223 PreProcessor and build your request body using Groovy language as it's described in the Apache Groovy - Parsing and producing JSON article如果
transactional_currencies
中的条目数是动态的,您可以 go 用于JSR223 预处理器并使用Groovy 语言构建您的请求主体,如Apache Groovy - 解析和生成 JSON文章中所述
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.