在录制运行时已经对相应的明显的数据进行参数化后,回放时经常出现最后的返回体是登录界面:
通过回放和抓包,基本上的问题在于,在进行跳转时会出现某个跳转缺少一个cookie,导致验证登录失败
通过抓包发现,在最后进行登录验证时会跳转多次,其中会产生一个cookie,该cookie无法被loadrunner自动获取。
可以通过
web_set_option("MaxRedirectionDepth", "1", LAST );来控制跳转,对跳转进行拆分,获取相应的cookies,利用
web_add_header("Cookie:","CASTGC={udctickes}");再次进行请求

// SSL登录过程中的处理:
// 由于向“clientproxytest.eyar.com/client/infosBeforSelectHospital.do?accountId=171713974470168776”需要跳转3次,其中需要获取一个cookies,故进行拆分操作
// 获取相应的cookies值 tsid开头的值给udc的header使用进行验证
// 验证通过后,登录成功,否则会进入登录页面,无法登录
// 开始验证登录

//获取cookies
web_reg_save_param(
"ParamName=locationudccookies",
"LB=Set-Cookie: ",
"RB=; Expires",
"notfound=warning",
"Search=All",
LAST);

//跳转一次
web_set_option("MaxRedirectionDepth", "1", LAST );

web_url("firstclientproxytest.do",
    "URL=https://clientproxytest.eyar.com/client/infosBeforSelectHospital.do?accountId=171713974470168776",
    "Resource=1",
    "RecContentType=application/json",
    "Referer=",
    "Snapshot=t6.inf",
    LAST);

 //跳转两次 ,添加cookie,使其登录成功  
web_set_option("MaxRedirectionDepth", "2", LAST );
web_add_header("Cookie:","CASTGC={udctickes}");

web_url("secondclientproxytest.do",
    "URL=https://udctest.eyar.com/login?service=https%3A%2F%2Fclientproxytest.eyar.com%2Fj_spring_cas_security_check",
      "Resource=1",
     "RecContentType=text/html, application/xhtml+xml, */*",
    "Referer=",
    "Snapshot=t6.inf",
    LAST);

//登录完成