JMeter是否与物理浏览器交互

Does JMeter interact with physical browser

我收到客户的报告,说我们的网络应用程序上的上传文件功能有时不起作用。我们在内部进行了测试,但没有发生。于是我用JMeter对web应用进行了Performance Test(模拟1000个用户同时上传)。我的经理说,在这种情况下,Graph Resutls 以及来自 JMeter 的摘要报告对检测问题可能出在哪里没有多大帮助。他问 JMeter 是否真的可以在 UI 上上传,我们可以看看发生了什么。

据我所知,JMeter 毕竟是一个模拟器,它无法像 Selenium WebDriver 那样与 Web 浏览器交互(?!)。无论如何要对上传按钮进行性能测试,我们实际上可以在 WepApp 上看到它吗?我希望我的问题是有道理的。

谢谢

您可以将 WebDriver 添加到 JMeter 以便与完全呈现的网页进行交互。

Web Driver Sampler automates the execution and collection of Performance metrics on the Browser (client-side). A large part of performance testing, up to this point, has been on the server side of things. However, with the advancement of technology, HTML5, JS and CSS improvements, more and more logic and behaviour have been pushed down to the client. This adds to the overall perceived performance of website/webapp, but this metric is not available in JMeter. Things that add to the overall browser execution time may include:

Client-side Javascript execution - eg. AJAX, JS templates CSS transforms - eg. 3D matrix transforms, animations 3rd party plugins - eg. Facebook like, Double click ads, site analytics, etc All these things add to the overall browser execution time, and this project aims to measure the time it takes to complete rendering all this content.

例如,您可以将此 Javascript 代码添加到脚本部分以导航到 Google。

WDS.sampleResult.sampleStart()
WDS.browser.get('http://google.com')
WDS.sampleResult.sampleEnd()

官方指南:https://jmeter-plugins.org/wiki/WebDriverTutorial/

浏览器不会施展任何魔法,它们只是发送 HTTP requests and render responses. JMeter can execute HTTP requests via its HTTP Request 采样器,因此从后端服务器的角度来看,文件上传是由真正的浏览器还是由 JMeter 进行的没有区别。

请参阅 How to make JMeter behave more like a real browser 文章以了解如何正确配置 JMeter,以便您的测试更加真实。


关于 Graph Result and Summary Report - 我不认为他们讲述了完整的故事。我建议采用以下方法:

  1. Response Assertion 添加到文件上传请求中,它将明确检查上传是否成功
  2. 从 1 个虚拟用户开始,逐渐增加负载,直到开始出现错误。
  3. 生成 HTML Reporting Dashboard 并查看增加的负载与其他指标(响应时间、每秒点击数、每秒错误数等)的关联程度