对于JMeter Post请求,如何从CSV(已经有JSON INSIXER)文件中发送多个主体请求?
我有一个CSV文件,并且有一百个JSON记录。我想从CSV一一派遣Jmeter Post的json。
并且得到了预期的结果,但是它在每个变量或数据中添加了“”。
[
{
"id":"1232435",
"ref":"88f000",
"data":"5a344f",
"number":"896751245"
}
]
我尝试了一下,
"[
{
""id"":""1232435"",
""ref"":""88f000"",
""data"":""5a344f"",
""number"":""896751245""
}
]"
我希望它与CSV文件相同。 在此处输入图像描述
I have a csv file and it has hundred record of JSON. I want to send JSON in body of JMETER post request one by one from CSV.
I tried this and I am getting desired results, but it is adding " " to every variable or data.for example: while sending this as a body
[
{
"id":"1232435",
"ref":"88f000",
"data":"5a344f",
"number":"896751245"
}
]
jmeeter is processing this body as
"[
{
""id"":""1232435"",
""ref"":""88f000"",
""data"":""5a344f"",
""number"":""896751245""
}
]"
I want it to process same as in csv file.
enter image description here
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我无法重现您的问题,请仔细检查您的 JSON 文件内容。
如果我将以下行放入 CSV 文件中:
它将按原样发送,不带任何额外的引号。
另外,您在 CSV 数据集配置中有
dataa
,在 HTTP 请求中有data
,所以您可能实际上并不是这样根本读文件是因为鉴于您当前的 CSV 数据集配置设置,您将仅将文件的第一行放入data
变量中,以使您的请求看起来像[
所以使用 调试采样器和查看结果树侦听器组合以查看变量是否正确以及它看起来如何。如果仍有多余的引号,可以使用 __strReplace() 函数
I cannot reproduce your issue, double check your JSON file contents.
If I put the following line into CSV file:
it's being sent as it is without any extra quotation marks.
Also you have
dataa
in the CSV Data Set Config anddata
in the HTTP Request so it might be the case that you're not actually reading the file at all because given your current CSV Data Set Config setup you would get only first line of the file into thedata
variable to wit your request would look like[
So use Debug Sampler and View Results Tree listener combination to see whether the variable is correct and how it does look like. If there are still extra quotation marks they can be removed using __strReplace() function