简体   繁体   English

Jmeter - 通过端口8080记录测试用例 - 超时错误

[英]Jmeter - Recording test cases through port 8080 - timeout error

I have created below setup in Jmeter to run recorded test cases. 我在Jmeter中创建了以下设置来运行记录的测试用例。

  1. Added Thread Group to test plan. 添加了线程组以测试计划。

  2. Added HTTP Request Defaults to thread group (in path section i have given url as ' http://localhost:8044 ') 将HTTP请求默认值添加到线程组(在路径部分我已将url作为' http:// localhost:8044 ')

    note : ' http://localhost:8044 ' is the url which i want to launch on firefox. 注意 :' http:// localhost:8044 '是我要在firefox上启动的网址。

  3. Added Recording controller to thread group 将记录控制器添加到线程组

In workbench Added HTTP(S) Test Script Recorder (In port section i have given 8080 as port no) 在工作台中添加了HTTP(S)测试脚本记录器(在端口部分我已经将8080作为端口号)

Now when I recorded test cases and played the test plan- test samples are failing with the following error. 现在,当我记录测试用例并播放测试计划时,测试样本失败并出现以下错误。

Error : Response code: Non HTTP response code: java.net.ConnectException Response message: Non HTTP response message: Connection timed out: connect 错误 :响应代码:非HTTP响应代码:java.net.ConnectException响应消息:非HTTP响应消息:连接超时:连接

Running this setup in virtual machine.I have tried with some other ports like 7070,8055,8044 but still getting same error. 在虚拟机中运行此设置。我已尝试使用其他一些端口,如7070,8055,8044但仍然得到相同的错误。

Not sure where the issue is. 不确定问题出在哪里。 Can any one please help me on this. 任何人都可以帮助我。

You have to setup the proxy in the browser also with same port that you mentioned in Test Script Recorder 您必须使用在Test Script Recorder提到的相同端口在浏览器中设置代理

  1. 8044 port - is in which server is listening (HTTP Sampler port) 8044端口 - 服务器正在侦听(HTTP采样器端口)
  2. 8080 port - is in which proxy server is listening (Test Script Recorder port) 8080端口 - 代理服务器正在侦听(测试脚本记录器端口)

Both are different. 两者都不同。 we need to configure proxy server port (which we specified in Test Script Recorder) in the browser setting also. 我们还需要在浏览器设置中配置代理服务器端口(我们在测试脚本记录器中指定)。

Note: If 8080 is already taken by some other process in your machine, try different port. 注意:如果您的计算机中的某些其他进程已经使用了8080,请尝试使用其他端口。

Setting up proxy in Firefox: 在Firefox中设置代理:

Options -> Advanced -> Network tab -> Settings button related to Connection -> enter port in Manual Proxy Configuration ). 选项 - >高级 - >网络选项卡 - >与连接相关的设置按钮 - >在Manual Proxy Configuration输入端口)。

Follow the steps mentioned here: 按照这里提到的步骤:

  1. https://jmeter.apache.org/usermanual/jmeter_proxy_step_by_step.pdf https://jmeter.apache.org/usermanual/jmeter_proxy_step_by_step.pdf
  1. Add Thread Group to test plan. 将线程组添加到测试计划。
  2. Add Transaction controller to thread group 将事务控制器添加到线程组
  3. Add HTTP(S)Test Script Recorder to workbench 将HTTP(S)测试脚本记录器添加到工作台

In HTTP(S)Test Script Recorder set global setting port to 8080 ,in target controller select the transaction controller in which you want to record the test click on start button before clicking start button you have to set proxy to record the script to do that go to firefox-option-Advanced-Network-Connection click on setting- select manual proxy config-in HTTP proxy give localhost and port 8080 and check the use this proxy server for all protocols . HTTP(S)Test Script Recorder中将全局设置端口设置为8080 ,在目标控制器中选择要在其中记录测试的transaction controller单击开始按钮,然后单击开始按钮,您必须设置代理以记录脚本以执行该操作转到firefox-option-Advanced-Network-Connection点击设置 - 选择手动代理配置 - 在HTTP代理中给出localhost and port 8080并检查使用此代理服务器的所有协议。

This works for me.Check if 8080 port used by another process to do so in cmd type netstat -an 这对我有用。检查另一个进程使用的8080端口是否在cmd类型netstat -an这样做

The issue is resolved. 问题得到解决。 Recording was not happening because of this. 由于这个原因,录音没有发生。

Firefox default setting will bypass "localhost, 127.0.0.1" from proxy so your JMeter still not able to record it. Firefox默认设置将绕过代理的“localhost,127.0.0.1”,因此您的JMeter仍然无法记录它。 You have to empty the "No Proxy for" field, by removing the "localhost, 127.0.0.1". 您必须通过删除“localhost,127.0.0.1”清空“No Proxy for”字段。 Hope this will help. 希望这会有所帮助。

I removed localhost, 127.0.0.1 from the no proxy field in firefox. 我从firefox中的no proxy字段中删除了localhost,127.0.0.1。

Got the fix from the link https://stackoverflow.com/a/37776363/4715839 从链接https://stackoverflow.com/a/37776363/4715839获得修复

Thanks all for sharing your comments. 感谢大家分享您的意见。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM