Loadrunner重放http响应返回与从浏览器手动执行时不同的return_uri

时间:2017-08-25 07:18:45

标签: https loadrunner

我已开始将HP Loadrunner用作性能测试项目的一部分。 我们尝试点击初始URL,重定向到身份服务器,然后重定向到Web门户登录屏幕。 现在我正在并行尝试在loadrunner日志和浏览器日志中查看消息交换(只是为了比较两个请求响应消息)。出于某种原因,即使初始HTTP GET消息看起来与浏览器相同,但从Web门户返回的响应也不尽相同。所以在location属性当我得到rediction url时,路径缺少redirect_uri点的端口号(..... / url:portnumber2 / .....)。这会产生第二次重定向的问题,而不是让我进入正确的重定向网址,它会将我带到错误页面重定向。

所以浏览器中的消息交换如下所示:

   Request URL:https://urladdress:portnumber1/
   Request Method:GET
   Status Code:302 
   Remote Address:10.33.5.83:4020
   Referrer Policy:no-referrer-when-downgrade
   Response Headers
   content-length:0
   date:Fri, 25 Aug 2017 06:50:47 GMT
   location:/connect/authorize?client_id=...&redirect_uri=https%3A%2F%2Furladdress%3Aportnumber%2F....sign........
   server:.......
   set-cookie:.AspNetCore.OpenIdConnect........
   set-cookie:.AspNetCore.........
   status:302
   x-powered-by:ASP.NET
   x-ua-compatible:IE=Edge,chrome=1
   Request Headers
   :authority:urladdress:portnumber1
   :method:GET
   :path:/
   :scheme:https
   accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
   accept-encoding:gzip, deflate, br
   accept-language:en-US,en;q=0.8
   upgrade-insecure-requests:1
   user-agent:.......

第二次重定向

    Request URL:https://urladdress:portnumber2/connect/authorize?......
    Request Method:GET
    Status Code:302 
    Remote Address:ipaddress:portnumber2
    Referrer Policy:no-referrer-when-downgrade
    Response Headers
    content-length:0
    date:Fri, 25 Aug 2017 06:50:47 GMT
    location:https://urladdress:portnumber2/account/login?.......
    server:......
    status:302
    x-powered-by:ASP.NET
    Request Headers
    :authority:urladdress:portnumber2
    :method:GET
    :path:/connect/authorize?......
    :scheme:https
    accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
    accept-encoding:gzip, deflate, br
    accept-language:en-US,en;q=0.8
    cookie:.AspNetCore.......
    upgrade-insecure-requests:1
    user-agent:..........

并且loadrunner中的消息交换看起来相同,唯一的区别是在return_uri属性结束后不包括portnumber2。 这导致重定向到错误页面而不是第二个重定向。 我们使用的脚本如下所示:

  web_set_sockets_option("SSL_VERSION", "TLS1.2");
web_cleanup_cookies();
web_cache_cleanup();
web_add_auto_header("Accept-Encoding","gzip, deflate, br");
web_add_auto_header("Accept-Language","en-US,en;q=0.8");
web_add_auto_header("Accept","text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8");
web_add_auto_header("Upgrade-Insecure-Requests","1");
web_add_auto_header("User-Agent","Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.101 Safari/537.36");

web_set_option("MaxRedirectionDepth","0",LAST);
web_set_max_html_param_len("10000000");

web_reg_save_param_ex("ParamName=url1",
                      "LB=Location: ",
                      "RB=\r\n",
                      LAST);

web_url("urladdress:portnumber1", 
    "URL=https://urladdress:portnumber1", 
    "Resource=0", 
    "RecContentType=text/html", 
    "Referer=", 
    "Mode=HTTP", 
    LAST);

lr_message("redirected address 1 = %s " ,lr_eval_string("{url1}"));

web_reg_save_param_ex("ParamName=url2",
                      "LB=Location: ",
                      "RB=\r\n",
                      LAST);
web_url("connect",
        "URL={url1}",
        "Resource=0", 
        "RecContentType=text/html", 
        "Referer=https://urladdress:portnumber1", 
        "Mode=HTTP",
        LAST);

return 0;

我需要知道为什么http响应消息不会获取URL上的端口号(可能我需要创建一个配置)。 任何其他可能有用的评论都会非常感激。

1 个答案:

答案 0 :(得分:0)

您是否认为具有双重定向,特别是临时重定向,将会带来巨大的性能损失。你有两个双握手连续。这是不好的魔法,与使用的测试工具无关。这是您的设计师/开发人员的糟糕架构。引用缺陷 - 获取最大重定向级别为1。