gpt4 book ai didi

java - 简单的 JMeter 测试不起作用

转载 作者:行者123 更新时间:2023-11-28 20:01:58 25 4
gpt4 key购买 nike

我们正在尝试在 JSF 应用程序中使用 JMeter 添加一个简单的测试。我们按照以下说明进行操作:

http://jmeter.apache.org/usermanual/build-adv-web-test-plan.html

它有一个带有用户名和密码的简单登录页面以及一个提交按钮。您可以从屏幕截图中看到我们使用了代理。通过屏幕截图中的设置,我们收到 HTTP 500 错误。我不确定我是否以正确的方式提出问题。请询问您是否需要任何说明。

enter image description here

Cookie Manager

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

错误代码为: enter image description here enter image description here

编辑:我认为这将是最长的 SO 问题。但有时图像胜于文字。不管怎样,我们所做的就是发送相当于我们在 Firebug 中看到的数据。但仍然出现 500 错误。在附件中可以看到Tomcat日志。

enter image description here enter image description here enter image description here enter image description here enter image description here enter image description here enter image description here enter image description here enter image description here enter image description here

最佳答案

HTTP 5xx 代码与服务器或应用程序错误有关。首先搜索日志文件。

您的脚本不需要“用户定义的变量”组件,因为没有真正需要按线程/用户计算的变量表达式。

“正则表达式提取器”组件足以提取 JSF ViewState 值。我建议您删除表达式的最后一部分“/>”,并将正则表达式分组 (.+?) 更改为 (\w+?),因为它会计算出几个匹配项(可能只有 2 个)。更改“匹配号”的值字段为 1(如果所有匹配的值都相同,则无需使用随机)。

我不明白你为什么同时使用“XPath Extractor”和“Regular Expression Extractor”组件来提取相同的值。在用 html 引导时,我更喜欢使用最后一个。在处理格式正确的 xml 字符串/文件时,XPath 更好。

要从头开始捕获脚本,我建议您在 Workbench 中添加一个“HTTP 代理服务器”,配置它,启动它,配置浏览器以使用此代理并使用浏览器导航这些页面。通过这种方式,您将捕获您选择的浏览器使用的所有请求和请求 header 。之后,去除不必要的请求,将查询参数,如javax.faces.ViewState,修改为对应的变量。

考虑在 HTTP 采样器中使用提取器(正处理器),然后再使用参数值中的变量。例如:如果/EBS 请求先出现并且/EBS/login.xhtml 请求有一个 javax.faces.ViewState 参数,那么/EBS 响应可能包含一个带有 javax.faces.ViewState 值的隐藏输入。

这是我使用的 JSF 应用程序测试脚本的常见组成部分。提供有关 HTTP 500 错误原因的更多信息应该阐明更好的解决方案。

关于java - 简单的 JMeter 测试不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10318499/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com