JMeter:涉及URL重定向的登录流程不起作用 [英] JMeter: Login flow involving URL redirection not working

查看:150
本文介绍了JMeter:涉及URL重定向的登录流程不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为登录流程发出具有有效凭据的https POST请求,它涉及发送一些参数和请求标头。我已经比较了Jmeter和Firefox(使用Firebug)之间的POST数据和请求标头(但使用Firebug),但是除了在请求标头中未通过jmeter发送cookie之外,我没有发现任何区别,因为我已经将Cookie管理器包含在测试计划中。

I am issuing a https POST request with valid credentials for a log in flow and it involves sending few parameters and request headers. I have compared POST data and Request Headers between Jmeter and Firefox (using Firebug) but I have not found any differences except for cookies not being sent through jmeter in Request headers as I have already included the Cookie manager in the test plan.

从firefox登录URL(状态代码302)将我重定向到主页URL(状态代码200)。现在的问题是Jmeter脚本将我重定向到与登录页面相同的资源URL好像我没有发送有效的凭据或请求标头。
我已经搜索了很多根本原因,但似乎无法弄清楚可能是什么问题。

Login url(status code 302) from firefox redirects me to home page url(status code 200).Now the problem is that Jmeter script is redirecting me to same resource url as login page as if I am not sending valid credentials or request headers. I have searched a lot for root cause but can't seem to figure out what could be the problem. Any insights/suggestions is appreciated.

推荐答案


除外,除非cookie不是通过Request头中的jmeter发送的,否则不胜感激。

except for cookies not being sent through jmeter in Request headers

这也许可以解释所有问题。为了发送Cookie,您需要获取 Cookie。真实用户打开登录页面,然后输入凭据并单击登录或提交或任何按钮。

That might explain everything. In order to send cookies you need to get cookies somewhere. Real user opens login page prior to typing credentials and clicking "login" or "submit" or whatever button.

设计测试计划,如下所示:

Design your test plan as follows:

- Config Elements (HTTP Cookie Manager, HTTP Request Defaults, User Defined Variables, etc)
- HTTP Request (GET login page)
    - Post Processors and Assertions if needed
- HTTP Request (POST credentials)

请参见如何使用JMeter进行登录身份验证文章,以获取全面说明。

See How To Use JMeter For Login Authentication article for comprehensive instructions.

一些个人建议:


  1. 更好记录您的测试方案框架,而不是像以前那样人工创建它。

  1. It's better to record your test scenario skeleton rather than creating it manually as errare humanum est. References:

  • HTTP(S) Test Script Recorder (was: HTTP Proxy Server )
  • Apache JMeter Proxy Step by Step

我既不信任JMeter也不信任Firebug,因此使用 Wireshark 比较来自真实浏览器和JMeter的请求

I don't trust neither JMeter nor Firebug hence using Wireshark to compare requests originating from the real browser and JMeter

这篇关于JMeter:涉及URL重定向的登录流程不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆