jmeter中可变长度的任何限制

Any limitation of variable length in jmeter

我正在使用 robotframework 和 jemetr 来自动化我的 API.I 我正在尝试将以下 json 数据从 robotframework 脚本传递到 jmeter 但它失败了,如果我减少 json 它正在工作的数据大小 fine.Please 让我知道是否有任何限制,如果有,解决方法是什么。

JSON数据:

{"fordate(dd-mm-yyyy)":"21-04-2021","user_id":"1","outlet_id":"10","warehouse_id":"1","skunit_id":"1","Quantity(case)":"","Quantity(units)":"2","Auto Scheme Apply":"","unitprice":"23","po_number":"","po_deliveryTime(dd-mm-yyyy)":"2021-04-22","id":"jqg1"}

机器人关键词:

Run Jmeter      ${jmeter}    ${jmxPath}  ${logPath}   -Jmdmpath=${mdmpath} -Jtestname=${TEST_NAME} -Jmdmid=75 -Jjsondata=${json}

Json 数据通过变量传递 ${json}

错误:

10:37:27.702    FAIL    JMeterLibException: 'Value returned by JMeter: 1'   
10:37:27.702    DEBUG   Traceback (most recent call last):
  File "/home/sadha/.local/lib/python3.8/site-packages/JMeterClasses.py", line 41, in runJmeter
    JMeterRunner(jmeterPath, testPlanPath, logFilePath, otherParams)
  File "/home/sadha/.local/lib/python3.8/site-packages/JMeterClasses.py", line 200, in __init__
    jmeterOutput = self.runAndPrintResult()
  File "/home/sadha/.local/lib/python3.8/site-packages/JMeterClasses.py", line 234, in runAndPrintResult
    raise JMeterLibException("%s %s" % (msg, retValue))

将您的 ${json} 放在引号中,例如:

-Jjsondata='${json}'

或者确保在 JSON

中使用反斜杠 \ 转义 所有特殊字符

更好的办法是将路径传递给 JSON 文件并使用 __FileToString() function. If you have multiple files in a folder it makes sense to use Directory Listing Config

在 JMeter 脚本中读取该文件

更多信息:Bash: Special Characters and Quoting

实际上 post 数据中有 space 导致了问题