背景:LR使用中,经常会使用遇到一些错误码,这里列出常用的错误码,会持续更新。
1. Error -84800 :insufficient records for parameter 'users' in table to provied the vuser with unique data
提示原因:参数不足。是由于Vuser设置为5个用户,但在controller中,由于疏忽,“Start Vusers”设置成了“Start 5 Vusers:5 every 00:00:05”
2. Error -26337: No match found for the requested parameter "xx". Check whether the requested boundaries exist in the response data. Also, if the data you want to save exceeds 100 bytes, use web_set_max_html_param_len to increase the parameter size.
提示原因:提取的字符串长度超过100bytes。需要在提取函数前添加函数和长度。如,web_set_max_html_param_len(“1024”)
3. HTML parsing not performed for Content-Type "application/json"("ParseHtmlContentType" Run-Time Setting is "TEXT")
提示原因:在请求中,少了“RecContentType”。例如,
web_url("getId",
"URL=http://localhost/api/v1/getId",
"TargetFrame=",
"Resource=0",
"RecContentType=application/json",
"Referer=",
"Snapshot=t1.inf",
"Mode=HTML",
LAST);
4.Warning -26601 Decompression function (wgzMemDecompressBuffer) failed,return code = -5 (Z_BUF_ERROR), inSize=0, inUse=0, outUse=0
提示原因:与缓冲区较小有关。调整“网络缓冲区大小”和“DOM内存分配的默认块大小”。
- 网络缓冲区大小:Vusers-> Run-time Settings->Internet Protocal->Preferences->Options。选择General->Network buffer size.在默认的数字后添加一个“0”即可。
- DOM内存分配的默认块大小:Vusers-> Run-time Settings->Internet Protocal->Preferences->Options。选择Web(Click and Script) Specific->Memory Management->Default block size for DOM memory...。在默认的数字后添加一个“0”即可。
5.Error -27492 HttpSendRequest failed
参考:https://blog.csdn.net/mao_xiaoxi/article/details/89680563。感谢作者,手动点赞!这篇文介绍了这种报错的原因,以及解决的办法。这里,简单复述一下。
在Vuser中录制和回放时,没有报错。但在Controller中报错,错误信息大体是这样的:Error -27492: "HttpSendRequest" failed, Windows error code=12002。
通常的解决方法:在Runtime-setting中的preferences-->options-->http-request connect timeout(sec)的值设为999。”但是这种方案并未能解决这个问题。
原因:LR sockets默认SSL的版本为SSL2和SSL3。当录制https时,如果SSL版本不一致,就会使sockets端口连接失败,被服务器拒绝连接,因此为使回放成功,很多人会勾选“winlnet replay instead of sockets(windows only)”。而这个勾选,也就是造成后面报错的罪魁祸首。
勾选“winlnet replay instead of sockets(windows only)”后,LR通过windows系统的WinInet来对外发送请求。但是微软的WinInet对流量的统计并不准确,而且当发送的请求超时20秒后,就会自动报错“请求已超时“。这一个超时,也就是造成开头报错的原因;即便在LR中设置preferences-->options-->http-request connect timeout(sec)的值设为999,也没用,因为发送的请求没不经过LR socket,LR统计不到。
解决方法
1)取消勾选”winlnet replay instead of sockets(windows only)“选项
2)在脚本中添加https请求前,添加函数 web_set_sockets_option("SSL_VERSION","TLS")。
注意:亲测时,该解决办法在LR11+Patch4这样的环境中可以生效,如果在LR11中则仍然会报错