我是JMeter的新手,我们正在使用它为我们的Node / Express服务器开发测试计划。我添加了两个HTTP请求:一个用于添加用户,另一个用于删除该用户。第一个请求(添加用户)运行正常,但第二个请求失败。失败的原因似乎是JMeter在请求中设置了两个Content-Length标头 - 一个是正确的而另一个是不正确的。服务器日志显示此错误:
{ [Error: request size did not match content length]
type: 'request.size.invalid',
message: 'request size did not match content length',
statusCode: 400,
status: 400,
received: 2,
expected: 1299,
length: 1299 }
在“查看结果树”中,我看到第二个请求具有以下标题:
Request Headers:
Connection: keep-alive
Content-Type: application/json
Content-Type: application/json; charset=utf-8
Date: Wed, 30 Sep 2015 18:50:17 GMT
Vary: Accept-Encoding
X-Powered-By: Express
Content-Length: 1299
Connection:
Content-Length: 2
User-Agent: Apache-HttpClient/4.2.6 (java 1.5)
正如您所看到的,JMeter设置了两个Content-Length
标题,我无法弄清楚原因(它应该是2
- 不确定1299
来自哪里)。 (我也注意到它也设置了两个Content-Type
标题,不确定它是否相关。)
我搜索了这个问题,似乎无法找到任何答案。如果有人有任何提示或建议,将不胜感激。我附上了JMeter的截图供参考(删除了敏感信息)。谢谢!
以下是运行测试时的JMeter日志:
2015/10/02 10:47:21 INFO - jmeter.engine.StandardJMeterEngine: Running the test!
2015/10/02 10:47:21 INFO - jmeter.samplers.SampleEvent: List of sample_variables: []
2015/10/02 10:47:21 INFO - jmeter.gui.util.JMeterMenuBar: setRunning(true,*local*)
2015/10/02 10:47:21 INFO - jmeter.engine.StandardJMeterEngine: Starting ThreadGroup: 1 : Thread Group
2015/10/02 10:47:21 INFO - jmeter.engine.StandardJMeterEngine: Starting 1 threads for group Thread Group.
2015/10/02 10:47:21 INFO - jmeter.engine.StandardJMeterEngine: Thread will continue on error
2015/10/02 10:47:21 INFO - jmeter.threads.ThreadGroup: Starting thread group number 1 threads 1 ramp-up 10 perThread 10000.0 delayedStart=false
2015/10/02 10:47:21 INFO - jmeter.threads.ThreadGroup: Started thread group number 1
2015/10/02 10:47:21 INFO - jmeter.engine.StandardJMeterEngine: All thread groups have been started
2015/10/02 10:47:21 INFO - jmeter.threads.JMeterThread: Thread started: Thread Group 1-1
2015/10/02 10:47:21 INFO - jmeter.services.FileServer: Stored: /Users/ljackson/Documents/users.csv
2015/10/02 10:47:22 INFO - jmeter.threads.JMeterThread: Thread is done: Thread Group 1-1
2015/10/02 10:47:22 INFO - jmeter.threads.JMeterThread: Thread finished: Thread Group 1-1
2015/10/02 10:47:22 INFO - jmeter.engine.StandardJMeterEngine: Notifying test listeners of end of test
2015/10/02 10:47:22 INFO - jmeter.services.FileServer: Close: /Users/ljackson/Documents/users.csv
2015/10/02 10:47:22 INFO - jmeter.gui.util.JMeterMenuBar: setRunning(false,*local*)