测试 Struts 应用程序:令牌处理

发布于 2024-07-27 13:37:33 字数 228 浏览 2 评论 0原文

我正在使用 JMeter 测试使用 saveTokenisTokenValid 方法的 Struts 应用程序。

我有一个页面用于选择项目列表,然后有一个页面用于更新其中一个项目。 当设置令牌时,将进入更新页面,但当我提交表单时,它会以某种方式发生变化。 有任何想法吗?

注意:我在 JMeter 测试中遵循与在浏览器中执行的相同路径。

I'm using JMeter to test a Struts application that uses the saveToken and isTokenValid mehods.

I have a page to select a list of items and then a page to update 1 of the items. When token is set going to the update page, but somehow it changes when I submit the form. Any Ideas?

Note: I follow the same path with the JMeter test as I do within the browser.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

汹涌人海 2024-08-03 13:37:33

以下是我为解决应用程序中的 formToken 问题所做的工作:

复制 HTTP 请求。 删除所有参数,并将其变成 GET。 将其放在原始请求(POST)之前,并将正则表达式添加到 GET,检索令牌。 在原始 POST 中,将令牌引用为变量。

该树看起来像这样:

. . .
GET 
+ Regex for Token
POST
. . .

让我知道这是否有帮助。

Here's what I've done to overcome the formToken problem in our app:

Duplicate the HTTP request. Remove all parameters, and turn it into a GET. Place it before your original request (the POST), and add a regex to the GET, retrieving the token. In the original POST, reference the token as a variable.

The tree would look like this:

. . .
GET 
+ Regex for Token
POST
. . .

Let me know if this helps.

蓝眸 2024-08-03 13:37:33

jmeter archives 我找到了您需要用来从第一个响应中获取令牌并将其添加到下一个采样器的正则表达式:

name="org\.apache\.struts\.taglib\.html\.TOKEN".*?value="(.*?)" 

In jmeter archives I found the regex you need to use to take the token from first response and add it to next sampler:

name="org\.apache\.struts\.taglib\.html\.TOKEN".*?value="(.*?)" 
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文