"Post" JMeter API 测试中的方法测试结果错误

"Post" method test result error in JMeter API testing

我尝试运行一个POST方法在JMeter中进行API测试,我已经根据需要发送了参数,但仍然显示不能post。

我应该怎么做才能让它发挥作用?

user add post request

response message

如果您正在测试 API,我的预期是您需要使用 HTTP Request 的 "Body Data" 选项卡发送 JSON 或 XML 负载采样器。

您还需要 HTTP Header Manager to send the relevant Content-Type header

参考文献:

另一种构建 Web 服务测试计划的方法是使用第 3 方工具(如 Postman or SoapUI and recording them via JMeter's HTTP(S) Test Script Recorder)根据您的测试场景执行请求。

在post请求中,您需要分别提供服务器名称或IP地址和端口号。如果仍然不起作用,请尝试通过添加 /api 然后添加 /user/data 来更改路径。它在某些情况下有效。 希望一切顺利!