处理jmeter中的动态弹出错误消息

handling dynamic pop-up error message in jmeter

我有一个应用程序的 Jmeter 脚本,我间歇性地弹出错误消息。在 jmeter 中,我们只知道流程被某些 failure.But 终止,我们不会知道错误弹出消息的发生。

我的要求是,如果我们遇到弹出错误,我想写入一个外部文件,说明当前页面因弹出错误消息而失败。 如果我们能写出错误信息,那就太棒了。到目前为止,我还没有实现这一目标的想法。 请任何人都可以帮助我。或者可以提供任何提示进行研发。

提前谢谢你。

用错误消息的屏幕截图更新了问题。

根据JMeter project main page

JMeter is not a browser, it works at protocol level. As far as web-services and remote services are concerned, JMeter looks like a browser (or rather, multiple browsers); however JMeter does not perform all the actions supported by browsers. In particular, JMeter does not execute the Javascript found in HTML pages. Nor does it render the HTML pages as a browser does (it's possible to view the response as HTML etc., but the timings are not included in any samples, and only one sample in one thread is ever displayed at a time).

查看您的屏幕截图,它是 JavaScript popup, most likely window.alert 的一种形式,因此无法通过 JMeter 检测到它。

您可以添加 Response Assertion to your test in order to introduce some pass/fail criteria, i.e. if you were in the middle of some transaction when the error occurred it should not finish successfully resulting in missing expected entry in the web page (or database), so you can conditionally fail relevant sampler(s) in this case. See How to Use JMeter Assertions in Three Easy Steps 以了解有关该概念的更多信息。


或者您可以使用 WebDriver Sampler plugin which provides JMeter integration with Selenium browser automation framework which drives a real browser, so you will be able to capture this popups and record the page titles/take screenshots, check out IsAlertPresent() class 获取更多信息。

你必须在你的 jmeter 请求中得到这个错误响应 response.simple answer.Have 要提取的正则表达式。